Micro-optimization

This commit is contained in:
Kovid Goyal 2017-05-19 07:15:12 +05:30
parent 8f63d98f0c
commit c4fce3eee9
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -7,8 +7,7 @@ LIGHT = '#F6F3E9'
LIGHT_DARKER = '#b6b3a8' LIGHT_DARKER = '#b6b3a8'
LIGHT_GRADIENT = 'linear-gradient(to bottom, {}, {})'.format(LIGHT, LIGHT_DARKER) LIGHT_GRADIENT = 'linear-gradient(to bottom, {}, {})'.format(LIGHT, LIGHT_DARKER)
def get_color(name): DEFAULT_COLORS = {
return {
# General colors # General colors
'window-background': LIGHT, 'window-background': LIGHT,
'window-background2': LIGHT_DARKER, 'window-background2': LIGHT_DARKER,
@ -38,11 +37,24 @@ def get_color(name):
'dialog-background': LIGHT, 'dialog-background': LIGHT,
'dialog-background-image': LIGHT_GRADIENT, 'dialog-background-image': LIGHT_GRADIENT,
'dialog-foreground': DARK, 'dialog-foreground': DARK,
}[name] }
def get_font_size(name): DEFAULT_SIZES = {
return {
'title': '1.4rem', 'title': '1.4rem',
'item-list-title': '1.1rem', 'item-list-title': '1.1rem',
'item-list-subtitle': '0.8rem', 'item-list-subtitle': '0.8rem',
}[name] }
DEFAULT_FONTS = {
'main': 'sans-serif'
}
def get_color(name):
return DEFAULT_COLORS[name]
def get_font_size(name):
return DEFAULT_SIZES[name]
def get_font_family(name):
name = name or 'main'
return DEFAULT_FONTS[name]