Make the colors of xocolors public

This commit is contained in:
Simon Schampijer 2008-04-26 20:16:49 +02:00
parent a13ef2209b
commit 6efdf259b6

View File

@ -17,7 +17,7 @@
import random import random
_colors = [ colors = [
['#B20008', '#FF2B34'], \ ['#B20008', '#FF2B34'], \
['#FF2B34', '#B20008'], \ ['#FF2B34', '#B20008'], \
['#E6000A', '#FF2B34'], \ ['#E6000A', '#FF2B34'], \
@ -218,8 +218,8 @@ def is_valid(color_string):
class XoColor: class XoColor:
def __init__(self, color_string=None): def __init__(self, color_string=None):
if color_string == None or not is_valid(color_string): if color_string == None or not is_valid(color_string):
n = int(random.random() * (len(_colors) - 1)) n = int(random.random() * (len(colors) - 1))
[self.stroke, self.fill] = _colors[n] [self.stroke, self.fill] = colors[n]
else: else:
[self.stroke, self.fill] = _parse_string(color_string) [self.stroke, self.fill] = _parse_string(color_string)
@ -244,7 +244,7 @@ if __name__ == "__main__":
f = open(sys.argv[1], 'r') f = open(sys.argv[1], 'r')
print '_colors = [' print 'colors = ['
for line in f.readlines(): for line in f.readlines():
match = re.match(r'fill: ([A-Z0-9]*) stroke: ([A-Z0-9]*)', line) match = re.match(r'fill: ([A-Z0-9]*) stroke: ([A-Z0-9]*)', line)