Skip to content

Commit 3cc4868

Browse files
committed
fix: theme preview, better implementation of default flavor
1 parent d6bbd3e commit 3cc4868

2 files changed

Lines changed: 93 additions & 8 deletions

File tree

‎blockbench.tera‎

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ whiskers:
77
/*
88
name: Catppuccin
99
author: Catppuccin
10+
version: 1.0
1011
borders: false
1112
options:
1213
flavor:
@@ -26,8 +27,54 @@ options:
2627
{%- endif %}{%- endfor %}
2728
*/
2829

30+
{%- set_global default_flavor = flavors['mocha'].colors %}
31+
32+
body {
33+
--color-ui: {{ default_flavor.base.hex }};
34+
--color-back: {{ default_flavor.mantle.hex }};
35+
--color-dark: {{ default_flavor.crust.hex }};
36+
--color-border: {{ default_flavor.overlay0.hex }};
37+
--color-selected: {{ default_flavor.surface1.hex }};
38+
--color-elevated: {{ default_flavor.surface0.hex }};
39+
--color-button: {{ default_flavor.surface0.hex }};
40+
--color-bright_ui: {{ default_flavor.text.hex }};
41+
--color-frame: {{ default_flavor.mantle.hex }};
42+
--color-text: {{ default_flavor.subtext1.hex }};
43+
--color-light: {{ default_flavor.text.hex }};
44+
--color-accent_text: {{ default_flavor.base.hex }};
45+
--color-bright_ui_text: {{ default_flavor.base.hex }};
46+
--color-subtle_text: {{ default_flavor.subtext0.hex }};
47+
--color-grid: {{ default_flavor.subtext0.hex }};
48+
--color-wireframe: {{ default_flavor.subtext0.hex }};
49+
--color-checkerboard: {{ default_flavor.surface1.hex }};
50+
51+
--color-accent: {{ default_flavor.mauve.hex }};
52+
}
53+
54+
/* Theme preview can only be accurate when theme selected,
55+
limitation with upstream */
56+
[theme_id="catppuccin"].theme_preview {
57+
--color-ui: inherit !important;
58+
--color-back: inherit !important;
59+
--color-dark: inherit !important;
60+
--color-border: inherit !important;
61+
--color-selected: inherit !important;
62+
--color-elevated: inherit !important;
63+
--color-button: inherit !important;
64+
--color-bright_ui: inherit !important;
65+
--color-frame: inherit !important;
66+
--color-text: inherit !important;
67+
--color-light: inherit !important;
68+
--color-accent_text: inherit !important;
69+
--color-bright_ui_text: inherit !important;
70+
--color-subtle_text: inherit !important;
71+
--color-grid: inherit !important;
72+
--color-wireframe: inherit !important;
73+
--color-checkerboard: inherit !important;
74+
--color-accent: inherit !important;
75+
}
76+
2977
{%- for flavorId, flavor in flavors %}
30-
{% if loop.last %}body,{% endif %}
3178
[theme-flavor="{{ flavorId }}"] {
3279
--color-ui: {{ flavor.colors.base.hex }};
3380
--color-back: {{ flavor.colors.mantle.hex }};
@@ -46,9 +93,6 @@ options:
4693
--color-grid: {{ flavor.colors.subtext0.hex }};
4794
--color-wireframe: {{ flavor.colors.subtext0.hex }};
4895
--color-checkerboard: {{ flavor.colors.surface1.hex }};
49-
{%- if loop.last %}
50-
--color-accent: {{ flavor.colors.mauve.hex }};
51-
{%- endif %}
5296
}
5397
{%- for colorId, color in flavor.colors %}{% if color.accent %}
5498
[theme-flavor="{{ flavorId }}"][theme-accent="{{ colorId }}"] {

‎themes/catppuccin.bbtheme‎

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
name: Catppuccin
33
author: Catppuccin
4+
version: 1.0
45
borders: false
56
options:
67
flavor:
@@ -29,6 +30,50 @@ options:
2930
lavender: Lavender
3031
*/
3132

33+
body {
34+
--color-ui: #1e1e2e;
35+
--color-back: #181825;
36+
--color-dark: #11111b;
37+
--color-border: #6c7086;
38+
--color-selected: #45475a;
39+
--color-elevated: #313244;
40+
--color-button: #313244;
41+
--color-bright_ui: #cdd6f4;
42+
--color-frame: #181825;
43+
--color-text: #bac2de;
44+
--color-light: #cdd6f4;
45+
--color-accent_text: #1e1e2e;
46+
--color-bright_ui_text: #1e1e2e;
47+
--color-subtle_text: #a6adc8;
48+
--color-grid: #a6adc8;
49+
--color-wireframe: #a6adc8;
50+
--color-checkerboard: #45475a;
51+
52+
--color-accent: #cba6f7;
53+
}
54+
55+
/* Theme preview can only be accurate when theme selected,
56+
limitation with upstream */
57+
[theme_id="catppuccin"].theme_preview {
58+
--color-ui: inherit !important;
59+
--color-back: inherit !important;
60+
--color-dark: inherit !important;
61+
--color-border: inherit !important;
62+
--color-selected: inherit !important;
63+
--color-elevated: inherit !important;
64+
--color-button: inherit !important;
65+
--color-bright_ui: inherit !important;
66+
--color-frame: inherit !important;
67+
--color-text: inherit !important;
68+
--color-light: inherit !important;
69+
--color-accent_text: inherit !important;
70+
--color-bright_ui_text: inherit !important;
71+
--color-subtle_text: inherit !important;
72+
--color-grid: inherit !important;
73+
--color-wireframe: inherit !important;
74+
--color-checkerboard: inherit !important;
75+
--color-accent: inherit !important;
76+
}
3277
[theme-flavor="latte"] {
3378
--color-ui: #eff1f5;
3479
--color-back: #e6e9ef;
@@ -90,7 +135,6 @@ options:
90135
[theme-flavor="latte"][theme-accent="lavender"] {
91136
--color-accent: #7287fd;
92137
}
93-
94138
[theme-flavor="frappe"] {
95139
--color-ui: #303446;
96140
--color-back: #292c3c;
@@ -152,7 +196,6 @@ options:
152196
[theme-flavor="frappe"][theme-accent="lavender"] {
153197
--color-accent: #babbf1;
154198
}
155-
156199
[theme-flavor="macchiato"] {
157200
--color-ui: #24273a;
158201
--color-back: #1e2030;
@@ -214,7 +257,6 @@ options:
214257
[theme-flavor="macchiato"][theme-accent="lavender"] {
215258
--color-accent: #b7bdf8;
216259
}
217-
body,
218260
[theme-flavor="mocha"] {
219261
--color-ui: #1e1e2e;
220262
--color-back: #181825;
@@ -233,7 +275,6 @@ body,
233275
--color-grid: #a6adc8;
234276
--color-wireframe: #a6adc8;
235277
--color-checkerboard: #45475a;
236-
--color-accent: #cba6f7;
237278
}
238279
[theme-flavor="mocha"][theme-accent="rosewater"] {
239280
--color-accent: #f5e0dc;

0 commit comments

Comments
 (0)