summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2016-05-10 14:19:02 +0200
committerBehdad Esfahbod <behdad@behdad.org>2016-05-10 14:19:02 +0200
commita700f0ef3ff26fd0632e0dc62ad2b4c9adaacf48 (patch)
tree28888658358f7044bb9c953a330e012b8dad9aac
parentc63fd71c940004e1c8b5e6aef3ee43d844dd4767 (diff)
[opentype-gx] Style
-rwxr-xr-xopentype-gx/opentypegx_slides.py4
-rw-r--r--opentype-gx/opentypegx_theme.py116
2 files changed, 31 insertions, 89 deletions
diff --git a/opentype-gx/opentypegx_slides.py b/opentype-gx/opentypegx_slides.py
index cbdbd1f..033313b 100755
--- a/opentype-gx/opentypegx_slides.py
+++ b/opentype-gx/opentypegx_slides.py
@@ -168,7 +168,7 @@ def title_slide (r):
valign=0, halign=0, desc=title_font+" 200")
r.move_to (960, 800)
- r.put_text ("<span font_size='large' font_desc='"+mono_font+"' foreground='blue'>https://goo.gl/0N3zLy</span>\n\n"+
+ r.put_text ("<span font_size='large' font_desc='"+mono_font+"' foreground='#0f007e'>https://goo.gl/0N3zLy</span>\n\n"+
"Behdad Esfahbod\n<span font_size='x-small' font_desc='"+mono_font+"'>behdad@google.com</span>", desc=body_font+" 50", halign=0, valign=+1)
def agenda(i=None):
@@ -184,7 +184,7 @@ def agenda(i=None):
]
if i is not None:
i = items.index(i)
- items[i] = "<span foreground='#444488'>%s</span>" % items[i]
+ items[i] = "<span foreground='#0f007e'>%s</span>" % items[i]
bullet_list_slide("Agenda", items)
agenda()
diff --git a/opentype-gx/opentypegx_theme.py b/opentype-gx/opentypegx_theme.py
index 9889193..a84d935 100644
--- a/opentype-gx/opentypegx_theme.py
+++ b/opentype-gx/opentypegx_theme.py
@@ -24,31 +24,21 @@ footer_margin = .06
padding = .000
bubble_rad = .25
-def bubble (cr, x0, y0, x, y, w, h):
-
- r = min (w, h) * (bubble_rad / (1 - 2./8*bubble_rad))
-
- p = r / 7.
- x, y, w, h, r = x - p, y - p, w + 2*p, h + 2*p, r + p
-
- x1, y1, x2, y2 = x, y, x + w, y + h
-
- cr.move_to (x1+r, y1)
- cr.line_to (x2-r, y1)
- cr.curve_to (x2, y1, x2, y1, x2, y1+r)
- cr.line_to (x2, y2-r)
- cr.curve_to (x2, y2, x2, y2, x2-r, y2)
- cr.line_to (x1+r, y2)
- cr.curve_to (x1, y2, x1, y2, x1, y2-r)
- cr.line_to (x1, y1+r)
- cr.curve_to (x1, y1, x1, y1, x1+r, y1)
- cr.close_path ()
-
- xc, yc = .5 * (x1 + x2), .5 * (y1 + y2)
- cr.move_to (xc+r, yc)
- cr.curve_to (xc+r, y0, .5 * (xc+r+x0), (yc+y0*2)/3, x0, y0)
- cr.curve_to (.5 * (xc-r+x0), (yc+y0*2)/3, xc-r, y0, xc-r, yc)
-
+fg_color = (.2,.2,.2)
+palette = [
+(0x0f,0x00,0x7e),
+(0x74,0x00,0xa5),
+(0xae,0x00,0x92),
+(0xdf,0x00,0x4e),
+(0xff,0x1a,0x0f),
+(0xff,0x42,0x04),
+(0xf1,0x90,0x00),
+(0xff,0xbc,0x00),
+]
+palette = palette + list(reversed(palette[1:-1]))
+palette_cairo = [tuple(c/1. for c in color) for color in palette]
+palette = ["#%02x%02x%02x" % color for color in palette]
+j = 0
def prepare_page (renderer):
cr = renderer.cr
@@ -62,31 +52,20 @@ def prepare_page (renderer):
p = padding * min (width, height)
p2 = 2 * p
+ cr.set_source_rgb (.9, .9, .9)
cr.paint ()
- sky = cairo.LinearGradient (0, 0, 0, height)
- sky.add_color_stop_rgba (0, 0x02/255., 0x23/255., 0x80/255., 1.)
- sky.add_color_stop_rgba (1, 0x9b/255., 0x84/255., 0x66/255., 1.)
- cr.set_source (sky)
- cr.paint ()
-
- # Background image
- #cr.move_to (width / 2., height / 2.)
- #renderer.put_image ("pillars.jpg", height = height, width = width)
+ cr.set_source_rgb (*fg_color)
cr.move_to (.5 * width, height-p2)
- b = 150.
- cr.set_source_rgb (0x9b/b, 0x84/b, 0x66/b)
- renderer.put_text ("TYPO Labs, 10 &amp; 11 May, 2016, Berlin", height=f-p2, valign=-1, desc="")
-
- # Cartoon icons for speakers
- who = renderer.data.get ('who', None)
- if who:
- if who < 0:
- cr.move_to (p, height-p)
- renderer.put_image ("behdad.png", width = a-p2, valign=-1, halign=+1)
- else:
- cr.move_to (width-p, height-p)
- renderer.put_image (who, width = a-p2, valign=-1, halign=-1)
+ text = unicode("TYPO Labs, 10–11 May, 2016, Berlin")
+ letters = []
+ global j
+ for i,c in enumerate(text):
+ color = palette[(i+j) % len(palette)]
+ letters.append('<span foreground="%s">%s</span>' % (color, c))
+ j -= 1
+ markup = ''.join(letters)
+ renderer.put_text (markup, height=f-p2, valign=-1, desc="")
# Compute rectangle available for slide content
w = width - s - s - p * 2
@@ -98,45 +77,8 @@ def prepare_page (renderer):
d = min (w, h) * bubble_rad / 8.
x, y, w, h = x + d, y + d, w - d*2, h - d*2
- return x, y, w, h
-def draw_bubble (renderer, x, y, w, h, data={}):
- # Fancy speech bubble!
- cr = renderer.cr
- width = renderer.width
- height = renderer.height
-
- s = avatar_margin * width
- p = padding * min (width, height)
-
- cr.save()
- x, y = cr.user_to_device (x, y)
- w, h = cr.user_to_device_distance (w, h)
- cr.identity_matrix ()
-
- who = data.get ('who', None)
- if not who:
- xc, yc = x + w*.5, y + h*.5
- elif who < 0:
- xc, yc = s * .9, height - .7 * s
- else:
- xc, yc = width - s * .9, height - .7 * s
-
- bubble (cr, xc, yc, x, y, w, h)
- cr.rectangle (width, 0, -width, height)
- cr.clip ()
-
- bubble (cr, xc, yc, x, y, w, h)
- #cr.set_source_rgb (0, 0, 0)
- #cr.set_line_width (p)
- #cr.set_miter_limit (20)
- #cr.stroke_preserve ()
-
- cr.restore ()
-
- cr.clip ()
- cr.set_source_rgba (1, 1, 1, .94)
- cr.paint ()
+ return x, y, w, h
- b = 700.
- cr.set_source_rgb (0xbe/b, 0xa3/b, 0x89/b)
+def draw_bubble (cr, x, y, w, h, data={}):
+ cr.set_source_rgb (*fg_color)