Tue, 12 Dec 2017 11:50:18 +0200
color -> colour
4 | 1 | class Colour: |
3
1dc58f44d556
Can now write dat files, added direct color handling
Santeri Piippo
parents:
2
diff
changeset
|
2 | def __init__(self, index): |
1dc58f44d556
Can now write dat files, added direct color handling
Santeri Piippo
parents:
2
diff
changeset
|
3 | self.index = int(index, 0) |
1dc58f44d556
Can now write dat files, added direct color handling
Santeri Piippo
parents:
2
diff
changeset
|
4 | def __str__(self): |
4 | 5 | if self.is_direct_colour(): |
6 | # write direct colours with hex codes | |
3
1dc58f44d556
Can now write dat files, added direct color handling
Santeri Piippo
parents:
2
diff
changeset
|
7 | return '0x%07X' % self.index |
1dc58f44d556
Can now write dat files, added direct color handling
Santeri Piippo
parents:
2
diff
changeset
|
8 | else: |
1dc58f44d556
Can now write dat files, added direct color handling
Santeri Piippo
parents:
2
diff
changeset
|
9 | return str(self.index) |
4 | 10 | def is_direct_colour(self): |
3
1dc58f44d556
Can now write dat files, added direct color handling
Santeri Piippo
parents:
2
diff
changeset
|
11 | return self.index >= 0x2000000 |