Skip to content

Commit 58de9fb

Browse files
committed
Create THEMES.md
1 parent d346e41 commit 58de9fb

File tree

1 file changed

+150
-0
lines changed

1 file changed

+150
-0
lines changed

llms/extensions/app/THEMES.md

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
# Themes in LLMs app
2+
3+
The LLMs app features a robust theming system that allows you to customize the look and feel of the application using a combination of CSS variables and Tailwind CSS utility classes.
4+
5+
## Available Default Themes
6+
7+
The application comes with the following themes built-in:
8+
9+
* **blue_smoke**
10+
* **dark**
11+
* **light**
12+
* **light_sky**
13+
* **light_slate**
14+
* **matrix**
15+
* **nord**
16+
* **soft_pink**
17+
18+
## How to Create a Custom Theme
19+
20+
Creating a new theme is straightforward. Themes are defined by JSON configuration files and optional assets.
21+
22+
### 1. Create a Theme Directory
23+
24+
You can add custom themes to the following locations:
25+
26+
```
27+
~/.llms/user/<username>/themes
28+
~/.llms/user/default/themes
29+
```
30+
31+
Themes in the `default` directory are available to all users, while themes in the `<username>` directory are only available to that user. Existing themes can be overridden by adding a folder with the same name.
32+
33+
### Example
34+
35+
Create a new directory for your theme. The directory name will be used as the internal identifier for your theme. For example, to create a theme called "Neon Vibes", you might create a folder named `neon_vibes`:
36+
37+
```bash
38+
mkdir -p ~/.llms/user/default/themes/neon_vibes
39+
cd ~/.llms/user/default/themes/neon_vibes
40+
```
41+
42+
### 2. Create `theme.json`
43+
44+
Inside your new theme directory, create a file named `theme.json`. This file is the core of your theme and contains the styling configuration.
45+
46+
The minimal [dark.json](https://github.com/ServiceStack/llms/blob/main/llms/extensions/app/themes/dark/theme.json) template just requires:
47+
48+
```json
49+
{
50+
"vars": {
51+
"colorScheme": "dark"
52+
}
53+
}
54+
```
55+
56+
Whilst the minimal [light.json](https://github.com/ServiceStack/llms/blob/main/llms/extensions/app/themes/light/theme.json) template just requires:
57+
58+
```json
59+
{
60+
"vars": {
61+
"colorScheme": "light"
62+
}
63+
}
64+
```
65+
66+
Any styles or vars that are not defined in your theme will fallback to the default **light** or **dark** theme.
67+
68+
### 3. Start from an existing theme
69+
70+
An alternative approach is to start from an existing theme from the built-in [themes](https://github.com/ServiceStack/llms/tree/main/llms/extensions/app/themes) directory.
71+
72+
Download a copy of the [dark.json](https://raw.githubusercontent.com/ServiceStack/llms/refs/heads/main/llms/extensions/app/themes/dark.json) theme template:
73+
74+
```bash
75+
curl -o theme.json https://raw.githubusercontent.com/ServiceStack/llms/refs/heads/main/llms/extensions/app/themes/dark.json
76+
```
77+
78+
Or download a copy of the [light.json](https://raw.githubusercontent.com/ServiceStack/llms/refs/heads/main/llms/extensions/app/themes/light.json) theme template:
79+
80+
```bash
81+
curl -o theme.json https://raw.githubusercontent.com/ServiceStack/llms/refs/heads/main/llms/extensions/app/themes/light.json
82+
```
83+
84+
A theme is composed of three main sections:
85+
86+
- `preview`: Tailwind classes for displaying the theme in the theme selector.
87+
- `vars`: Standard CSS variables handling the underlying color scheme, background, and borders. You must define `"colorScheme"` as `"light"` or `"dark"`.
88+
- `styles`: Tailwind utilities mapping specific UI components to their respective classes.
89+
90+
### 4. Adding Theme Assets (Optional)
91+
92+
If your theme includes custom assets like background images or distinct icons, you can create a `ui/` directory within your theme folder (e.g., `llms/extensions/app/themes/neon_vibes/ui/bg.webp`).
93+
94+
You can then reference these assets in your `theme.json` file. For instance, to use a custom background image, you can define it in the `vars` section:
95+
96+
```json
97+
{
98+
"vars": {
99+
"colorScheme": "dark",
100+
"--background-image": "url(/themes/neon_vibes/ui/bg.webp)"
101+
},
102+
"styles": {
103+
"app": "bg-[image:var(--background-image)] bg-cover"
104+
}
105+
}
106+
```
107+
*(Note: Assets placed in the `ui` folder are served dynamically by the application.)*
108+
109+
### 5. Typography in Markdown
110+
111+
Themes can also define the typography used in markdown by overriding these [Typography CSS variables](https://github.com/ServiceStack/llms/blob/main/llms/extensions/app/themes/shared.json):
112+
113+
```json
114+
{
115+
"vars": {
116+
"--tw-prose-body": "#374151",
117+
"--tw-prose-headings": "#111827",
118+
"--tw-prose-lead": "#4b5563",
119+
"--tw-prose-links": "#111827",
120+
"--tw-prose-bold": "#111827",
121+
"--tw-prose-counters": "#6b7280",
122+
"--tw-prose-bullets": "#d1d5db",
123+
"--tw-prose-hr": "#e5e7eb",
124+
"--tw-prose-quotes": "#111827",
125+
"--tw-prose-quote-borders": "#e5e7eb",
126+
"--tw-prose-captions": "#6b7280",
127+
"--tw-prose-code": "#111827",
128+
"--tw-prose-pre-code": "#e5e7eb",
129+
"--tw-prose-pre-bg": "#282c34",
130+
"--tw-prose-th-borders": "#d1d5db",
131+
"--tw-prose-td-borders": "#e5e7eb",
132+
"--tw-prose-invert-body": "#d1d5db",
133+
"--tw-prose-invert-headings": "#fff",
134+
"--tw-prose-invert-lead": "#9ca3af",
135+
"--tw-prose-invert-links": "#fff",
136+
"--tw-prose-invert-bold": "#fff",
137+
"--tw-prose-invert-counters": "#9ca3af",
138+
"--tw-prose-invert-bullets": "#4b5563",
139+
"--tw-prose-invert-hr": "#374151",
140+
"--tw-prose-invert-quotes": "#f3f4f6",
141+
"--tw-prose-invert-quote-borders": "#374151",
142+
"--tw-prose-invert-captions": "#9ca3af",
143+
"--tw-prose-invert-code": "#fff",
144+
"--tw-prose-invert-pre-code": "#d1d5db",
145+
"--tw-prose-invert-pre-bg": "rgb(0 0 0 / 50%)",
146+
"--tw-prose-invert-th-borders": "#4b5563",
147+
"--tw-prose-invert-td-borders": "#374151"
148+
}
149+
}
150+
```

0 commit comments

Comments
 (0)