You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
select'Default theme'as title, '?theme=default'as link, 'Default theme'as description, case $theme when 'default' then 'primary' end as color, $theme ='default'as disabled;
21
+
select'Custom theme'as title, '?theme=custom'as link, 'Custom theme'as description, case $theme when 'custom' then 'primary' end as color, $theme ='custom'as disabled;
22
+
23
+
12
24
select'card'as component, 'Colors'as title;
13
25
select color as title, hex as description, color as background_color
14
-
from colors;
26
+
from colors;
27
+
28
+
29
+
select'text'as component, '
30
+
The colors above are from the [official site custom theme](https://github.com/sqlpage/SQLPage/blob/main/examples/official-site/assets/highlightjs-and-tabler-theme.css).
31
+
View [this page with the default theme](?theme=default) to see the colors that are used by default.
32
+
'as contents_md where $theme ='custom';
33
+
34
+
select'text'as component, '
35
+
### Customization and theming
36
+
37
+
SQLPage is designed to be easily customizable and themable.
38
+
You cannot pass arbitrary color codes to components from your SQL queries,
39
+
but you can customize which exact color is associated to each color name.
40
+
41
+
#### Creating a custom theme
42
+
43
+
To create a custom theme, you can create a CSS file and use the [shell component](/component.sql?component=shell) to include it.
44
+
45
+
##### `index.sql`
46
+
47
+
```sql
48
+
select ''shell'' as component, ''custom_theme.css'' as css, ''custom_theme'' as theme;
49
+
```
50
+
51
+
##### `custom_theme.css`
52
+
53
+
```css
54
+
:root,
55
+
.layout-boxed[data-bs-theme="custom_theme"] {
56
+
color-scheme: light;
57
+
58
+
/* Base text colors */
59
+
--tblr-body-color: #cfd5e6;
60
+
--tblr-text-secondary-rgb: 204, 209, 217;
61
+
--tblr-secondary-color: #cccccc;
62
+
--tblr-muted-color: rgba(191, 191, 191, 0.8);
63
+
64
+
/* Background colors */
65
+
--tblr-body-bg: #0f1426;
66
+
--tblr-bg-surface: #111629;
67
+
--tblr-bg-surface-secondary: #151a2e;
68
+
--tblr-bg-surface-tertiary: #191f33;
69
+
70
+
/* Primary and secondary colors */
71
+
--tblr-primary-rgb: 95, 132, 169;
72
+
--tblr-primary: rgb(var(--tblr-primary-rgb));
73
+
--tblr-secondary-rgb: 235, 232, 255;
74
+
--tblr-secondary: rgb(var(--tblr-secondary-rgb));
75
+
76
+
/* Border colors */
77
+
--tblr-border-color: #151926;
78
+
--tblr-border-color-translucent: #404d73b3;
79
+
80
+
/* Theme colors. All sqlpage colors can be customized in the same way. */
81
+
--tblr-blue-rgb: 84, 151, 213; /* To convert between #RRGGBB color codes to decimal RGB values, you can use https://www.rapidtables.com/web/color/RGB_Color.html */
0 commit comments