-
-
Notifications
You must be signed in to change notification settings - Fork 473
/
bootstrap.py
74 lines (57 loc) · 1.62 KB
/
bootstrap.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
from __future__ import annotations
import pathlib
import param
from ..io.resources import CDN_DIST, CSS_URLS, JS_URLS
from ..layout import Accordion, Card
from ..viewable import Viewable
from ..widgets import Number, Tabulator
from .base import (
DarkTheme, DefaultTheme, Design, Inherit,
)
class BootstrapDefaultTheme(DefaultTheme):
"""
The BootstrapDefaultTheme is a light theme.
"""
css = param.Filename(default=pathlib.Path(__file__).parent / 'css' / 'bootstrap_default.css')
_bs_theme = 'light'
class BootstrapDarkTheme(DarkTheme):
"""
The BootstrapDarkTheme is a Dark Theme in the style of Bootstrap
"""
css = param.Filename(default=pathlib.Path(__file__).parent / 'css' / 'bootstrap_dark.css')
_bs_theme = 'dark'
modifiers = {
Number: {
'default_color': 'white'
}
}
class Bootstrap(Design):
modifiers = {
Accordion: {
'active_header_background': 'var(--bs-surface-bg)'
},
Card: {
'children': {'margin': (10, 10)},
'button_css_classes': ['card-button'],
'margin': (10, 5)
},
Tabulator: {
'theme': 'bootstrap5',
'theme_classes': ['table-sm']
},
Viewable: {
'stylesheets': [Inherit, f'{CDN_DIST}bundled/theme/bootstrap.css']
}
}
_themes = {
'dark': BootstrapDarkTheme,
'default': BootstrapDefaultTheme,
}
_resources = {
'css': {
'bootstrap': CSS_URLS['bootstrap5']
},
'js': {
'bootstrap': JS_URLS['bootstrap5']
}
}