-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vitepress.tera
135 lines (117 loc) Β· 5.97 KB
/
vitepress.tera
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
---
whiskers:
version: 2.5.0
matrix:
- flavor: ["frappe", "macchiato", "mocha"]
- accent
filename: "theme/{{flavor.identifier}}/{{accent}}.css"
hex_format: "#{{r}}{{g}}{{b}}{{z}}"
---
/* https://github.com/vuejs/vitepress/blob/main/src/client/theme-default/styles/vars.css */
/* https://catppuccin.com/palette */
{% set modes = ["light", "dark"] -%}
{% for mode in modes %}
{%- if mode == "light" -%}
{%- set palette = flavors["latte"].colors %}
{%- set paletteid = flavors["latte"].identifier %}
:root {
{% else -%}
{%- set palette = flavor.colors %}
{%- set paletteid = flavor.identifier %}
.dark {
/* Fix button text color */
--vp-button-brand-text: var(--ctp-{{ paletteid }}-crust) !important;
--vp-button-brand-hover-text: var(--ctp-{{ paletteid }}-crust) !important;
--vp-button-brand-active-text: var(--ctp-mocha-crust) !important;
{% endif -%}
/* Accent Color */
--vp-c-brand-1: {{ palette[accent].hex }};
--vp-c-brand-2: {{ palette[accent] | sub(lightness=5) | css_rgb }};
--vp-c-brand-3: {{ palette[accent].hex }};
/* Solid Colors and Sponsor Color */
{%- if mode == "light" %}
--vp-c-white: {{ palette.base.hex }};
--vp-c-black: {{ palette.text.hex }};
{%- else %}
--vp-c-white: {{ palette.text.hex }};
--vp-c-black: {{ palette.base.hex }};
{%- endif %}
--vp-c-sponsor: {{ palette.red.hex }};
/* Background Colors */
--vp-c-bg: {{ palette.base.hex }};
--vp-c-bg-alt: {{ palette.mantle.hex }};
--vp-c-bg-elv: {{ palette.crust.hex }};
--vp-c-bg-soft: {{ palette.mantle.hex }};
/* Border Colors */
--vp-c-border: {{ palette.surface0.hex }};
--vp-c-divider: {{ palette.surface0.hex }};
--vp-c-gutter: {{ palette.surface1.hex }};
/* Text Colors */
--vp-c-text-1: {{ palette.text.hex }};
--vp-c-text-2: {{ palette.subtext1.hex }};
--vp-c-text-3: {{ palette.subtext0.hex }};
/* Callout Colors */
--vp-c-tip-soft: {{ palette.green | mod(opacity=0.2) | css_hsla }};
--vp-c-warning-soft: {{ palette.yellow | mod(opacity=0.2) | css_hsla }};
--vp-c-danger-soft: {{ palette.red | mod(opacity=0.2) | css_hsla }};
--vp-c-caution-soft: {{ palette.red | mod(opacity=0.2) | css_hsla }};
--vp-c-important-soft: {{ palette.mauve | mod(opacity=0.2) | css_hsla }};
--vp-custom-block-info-bg: {{ palette.sky | mod(opacity=0.2) | css_hsla }};
--vp-custom-block-note-bg: {{ palette.blue | mod(opacity=0.2) | css_hsla }};
--vp-custom-block-details-bg: {{ palette.surface0.hex }};
/* Catppuccin Accents */
{% for color_name, color in palette -%}
--ctp-{{ paletteid }}-{{ color_name }}: {{ color.hex }};
{% endfor %}
/* Color Palette */
{%- if mode == "light" %}
{%- set saturation = 10 %}
{%- set mix_amount = 0.5 %}
{%- set lightness_amount = 20 %}
{%- set opacity_mod = 0.14 %}
{%- set lightness_amount_gray = 30 %}
{%- else %}
{%- set saturation = 10 %}
{%- set mix_amount = 0.5 %}
{%- set lightness_amount = 20 %}
{%- set opacity_mod = 0.14 %}
{%- set lightness_amount_gray = 30 %}
{%- endif %}
--vp-c-gray-1: {{palette.surface1 | css_rgb}};
--vp-c-gray-2: {{palette.surface0 | css_rgb}};
--vp-c-gray-3: {{palette.base | css_rgb}};
{%- if mode == "light" %}
--vp-c-gray-soft: {{palette.base | sub(lightness=lightness_amount_gray) | mod(opacity=opacity_mod) | css_hsla}};
{%- else %}
--vp-c-gray-soft: {{palette.base | add(lightness=lightness_amount_gray) | mod(opacity=opacity_mod) | css_hsla}};
{%- endif %}
--vp-c-default-soft: {{ palette.surface0.hex }};
--vp-c-indigo-1: {{palette.blue | css_rgb}};
--vp-c-indigo-2: {{palette.blue | add(saturation=saturation) | css_rgb}};
--vp-c-indigo-3: {{palette.blue | mix(color=base, amount=mix_amount) | css_rgb}};
--vp-c-indigo-soft: {{palette.blue | sub(lightness=lightness_amount) | mod(opacity=opacity_mod) | css_hsla}};
--vp-c-purple-1: {{palette.mauve | css_rgb}};
--vp-c-purple-2: {{palette.mauve | add(saturation=saturation) | css_rgb}};
--vp-c-purple-3: {{palette.mauve | mix(color=base, amount=mix_amount) | css_rgb}};
--vp-c-purple-soft: {{palette.mauve | sub(lightness=lightness_amount) | mod(opacity=opacity_mod) | css_hsla}};
--vp-c-green-1: {{palette.green | css_rgb}};
--vp-c-green-2: {{palette.green | add(saturation=saturation) | css_rgb}};
--vp-c-green-3: {{palette.green | mix(color=base, amount=mix_amount) | css_rgb}};
--vp-c-green-soft: {{palette.green | sub(lightness=lightness_amount) | mod(opacity=opacity_mod) | css_hsla}};
--vp-c-yellow-1: {{palette.yellow | css_rgb}};
--vp-c-yellow-2: {{palette.yellow | add(saturation=saturation) | css_rgb}};
--vp-c-yellow-3: {{palette.yellow | mix(color=base, amount=mix_amount) | css_rgb}};
--vp-c-yellow-soft: {{palette.yellow | sub(lightness=lightness_amount) | mod(opacity=opacity_mod) | css_hsla}};
--vp-c-red-1: {{palette.red | css_rgb}};
--vp-c-red-2: {{palette.red | add(saturation=saturation) | css_rgb}};
--vp-c-red-3: {{palette.red | mix(color=base, amount=mix_amount) | css_rgb}};
--vp-c-red-soft: {{palette.red | sub(lightness=lightness_amount) | mod(opacity=opacity_mod) | css_hsla}};
/* Icons */
{% set icon_copy = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="' ~ subtext0.hex ~ '" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24"><rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/></svg>' %}
{% set icon_copied = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="' ~ subtext0.hex ~ '" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24"><rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/><path d="m9 14 2 2 4-4"/></svg>' %}
--vp-icon-copy: url('data:image/svg+xml,{{ icon_copy | urlencode }}');
--vp-icon-copied: url('data:image/svg+xml,{{ icon_copied | urlencode }}');
/* Code Highlighting */
--vp-code-line-highlight-color: {{ palette.overlay2 | mod(opacity=0.2) | css_hsla }};
}
{%- endfor %}