summaryrefslogtreecommitdiff
path: root/tools/icons/palette.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/icons/palette.py')
-rw-r--r--tools/icons/palette.py53
1 files changed, 53 insertions, 0 deletions
diff --git a/tools/icons/palette.py b/tools/icons/palette.py
new file mode 100644
index 0000000..4227964
--- /dev/null
+++ b/tools/icons/palette.py
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+
+import math
+import cairo
+
+
+WIDTH, HEIGHT = 256, 256
+WIDTH, HEIGHT = 12, 12
+
+surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, WIDTH, HEIGHT)
+ctx = cairo.Context(surface)
+
+ctx.scale(WIDTH, HEIGHT)
+
+ctx.arc(0.5, 0.5, 0.40, 0, 2 * math.pi)
+ctx.set_source_rgb(1.0, 1.0, 1.0)
+ctx.fill()
+
+colors = [
+ 'fefe33',
+ 'fabc02',
+ 'fb9902',
+ 'fd5308',
+ 'fe2712',
+ 'a7194b',
+ '8601af',
+ '3d01a4',
+ '0247fe',
+ '0391ce',
+ '66b032',
+ 'd0ea2b'
+]
+
+angle = (2 * math.pi) / len(colors)
+
+for i in range(len(colors)):
+
+ hval = int(colors[i], 16)
+
+ red = ((hval & 0xff0000) >> 16) / 256
+ green = ((hval & 0x00ff00) >> 8) / 256
+ blue = ((hval & 0x0000ff) >> 0) / 256
+
+ start = angle / 2 - i * angle
+
+ ctx.arc(0.5, 0.5, 0.5, start - angle, start)
+
+ ctx.arc_negative(0.5, 0.5, 0.15, start, start - angle)
+
+ ctx.set_source_rgb(red, green, blue)
+ ctx.fill()
+
+surface.write_to_png('../../pixmaps/palette.png')