Skip to content

Commit 28b6b3d

Browse files
Additions to developer theme docs (#34)
* background-filter warning * note os accent color and variable overrides * text-wrap pretty * support light themed codeblocks
1 parent 96472ca commit 28b6b3d

4 files changed

Lines changed: 28 additions & 2 deletions

File tree

.vitepress/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ const VITEPRESS_CONFIG: UserConfig<DefaultTheme.Config> = {
142142

143143
await shiki.loadLanguage(bdcss);
144144
},
145-
theme: "dark-plus",
145+
theme: {dark: "dark-plus", light: "light-plus"},
146146
config: (md) => {
147147
md.use(groupIconMdPlugin);
148148
}

.vitepress/theme/custom.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ span.line .global-bdapi {
2727
}
2828
}
2929

30+
.vp-doc p {
31+
text-wrap: pretty;
32+
}
33+
3034

3135
/* TODO: poll this */
3236
/* .vp-doc a.header-anchor {

docs/themes/intermediate/transparency.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ You'll see that suddenly you can partially see your desktop through the Discord
2424

2525
You can also consider making just part of your theme see-through by keeping one section completely opaque. It adds an interesting dichotomy and a unique feel to your theme.
2626

27+
Note that using `backdrop-filter` above a transparent window will **not** blur anything behind it. It will only blur the elements within the Discord client itself, and on some platforms may leave some unpleasant rendering artifacts.
28+
2729
## Builder
2830

2931
If you really just want to make a theme where you have a background image, or to see through to your desktop, don't fire up your editor just yet. A community member has made a theme builder than can take existing BetterDiscord themes and customize them as you see fit, including adding background images or making them see-through to the desktop. For more information check out the website here: [https://bdeditor.dev/](https://bdeditor.dev/)

docs/themes/intermediate/user.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Letting users configure your theme to their personal preference is one of the mo
1212

1313
If you weren't already aware, CSS variables (sometimes known as custom properties), are a way to reuse the same values over and over while making them easily changeable later. MDN, of course, has [a great article](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties) on this. The best way to use these is to find values that you reuse over and over in your theme and turn them into a custom property you can change later. One of the most common use-cases in a theme is for the theme's main accent color. They're also frequently used for background colors and sizing of different elements. Every theme is a bit different in that regard, but they all follow the same general rule of thumb: If it's something you're doing repeatedly and consistently, making it a variable makes it easy to change later for both the end-users as well as for you.
1414

15+
For example, BetterDiscord already offers a variable that you can use in your themes. It's called `--os-accent-color`. This variable represents the accent color of the user's operating system. This is useful for making your theme feel more native to the user's system.
16+
1517
### How can I use them?
1618

1719
Using CSS variables in BetterDiscord is exactly like in regular CSS. Simply declare it somewhere high in the document tree and reuse it in your theme. At a glace it might look something like this:
@@ -40,7 +42,7 @@ h1 {
4042
}
4143
```
4244

43-
It is very important to note that these cannot be used as properties or part of media queries. That is to say, both of these below are invalid.
45+
It is very important to note that the `var()` syntax cannot be used as properties or part of media queries. That is to say, both of these below are invalid.
4446

4547
```css
4648
:root {
@@ -59,6 +61,24 @@ h1 {
5961
}
6062
```
6163

64+
However, you can *override* variables in any selector. This means you can set a variable in `:root` and then override it in descendant selectors. This can be useful for when you want to change a variable for a specific part of the UI.
65+
66+
```css
67+
:root {
68+
--my-variable: red;
69+
}
70+
71+
h1, h2 {
72+
color: var(--my-variable);
73+
}
74+
75+
h2 {
76+
--my-variable: blue;
77+
}
78+
```
79+
80+
In this case, `h1` will be red and `h2` will be blue.
81+
6282
### Special Cases
6383

6484
#### Fallback

0 commit comments

Comments
 (0)