mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Micro-optimization
This commit is contained in:
parent
8f63d98f0c
commit
c4fce3eee9
@ -7,42 +7,54 @@ 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)
|
||||||
|
|
||||||
|
DEFAULT_COLORS = {
|
||||||
|
# General colors
|
||||||
|
'window-background': LIGHT,
|
||||||
|
'window-background2': LIGHT_DARKER,
|
||||||
|
'window-foreground': DARK,
|
||||||
|
'window-error-foreground': 'red',
|
||||||
|
'window-hover-foreground': 'red',
|
||||||
|
|
||||||
|
# Top bar specific colors
|
||||||
|
'bar-background': DARK,
|
||||||
|
'bar-foreground': LIGHT,
|
||||||
|
'bar-highlight': 'yellow',
|
||||||
|
'heart': '#B92111',
|
||||||
|
|
||||||
|
# Item list colors
|
||||||
|
'list-hover-background': DARK,
|
||||||
|
'list-hover-foreground': LIGHT,
|
||||||
|
|
||||||
|
# Tree colors
|
||||||
|
'tree-highlight-item': LIGHT_DARKER,
|
||||||
|
|
||||||
|
# Button colors
|
||||||
|
'button-start': DARK,
|
||||||
|
'button-end': '#49423B',
|
||||||
|
'button-text': LIGHT,
|
||||||
|
|
||||||
|
# Dialog colors
|
||||||
|
'dialog-background': LIGHT,
|
||||||
|
'dialog-background-image': LIGHT_GRADIENT,
|
||||||
|
'dialog-foreground': DARK,
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFAULT_SIZES = {
|
||||||
|
'title': '1.4rem',
|
||||||
|
'item-list-title': '1.1rem',
|
||||||
|
'item-list-subtitle': '0.8rem',
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFAULT_FONTS = {
|
||||||
|
'main': 'sans-serif'
|
||||||
|
}
|
||||||
|
|
||||||
def get_color(name):
|
def get_color(name):
|
||||||
return {
|
return DEFAULT_COLORS[name]
|
||||||
# General colors
|
|
||||||
'window-background': LIGHT,
|
|
||||||
'window-background2': LIGHT_DARKER,
|
|
||||||
'window-foreground': DARK,
|
|
||||||
'window-error-foreground': 'red',
|
|
||||||
'window-hover-foreground': 'red',
|
|
||||||
|
|
||||||
# Top bar specific colors
|
|
||||||
'bar-background': DARK,
|
|
||||||
'bar-foreground': LIGHT,
|
|
||||||
'bar-highlight': 'yellow',
|
|
||||||
'heart': '#B92111',
|
|
||||||
|
|
||||||
# Item list colors
|
|
||||||
'list-hover-background': DARK,
|
|
||||||
'list-hover-foreground': LIGHT,
|
|
||||||
|
|
||||||
# Tree colors
|
|
||||||
'tree-highlight-item': LIGHT_DARKER,
|
|
||||||
|
|
||||||
# Button colors
|
|
||||||
'button-start': DARK,
|
|
||||||
'button-end': '#49423B',
|
|
||||||
'button-text': LIGHT,
|
|
||||||
|
|
||||||
# Dialog colors
|
|
||||||
'dialog-background': LIGHT,
|
|
||||||
'dialog-background-image': LIGHT_GRADIENT,
|
|
||||||
'dialog-foreground': DARK,
|
|
||||||
}[name]
|
|
||||||
|
|
||||||
def get_font_size(name):
|
def get_font_size(name):
|
||||||
return {
|
return DEFAULT_SIZES[name]
|
||||||
'title': '1.4rem',
|
|
||||||
'item-list-title': '1.1rem',
|
def get_font_family(name):
|
||||||
'item-list-subtitle': '0.8rem',
|
name = name or 'main'
|
||||||
}[name]
|
return DEFAULT_FONTS[name]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user