docs: add how to write a userstyle guide (#353)

Co-authored-by: Isabel <[email protected]>
Co-authored-by: Muslim <[email protected]>
This commit is contained in:
authored and GitHub committed 2024-01-19 00:15:19 +00:00
1 parent 9b80256957
commit d941a27e6b
6 files changed
+243 -31

No files matched your search

+22 -27
View File
@@ -1,11 +1,11 @@
/* ==UserStyle==
@name <port name> Catppuccin
@namespace github.com/catppuccin/userstyles/styles/<port name>
@homepageURL https://github.com/catppuccin/userstyles/tree/main/styles/<port name>
@name <port-name> Catppuccin
@namespace github.com/catppuccin/userstyles/styles/<port-name>
@homepageURL https://github.com/catppuccin/userstyles/tree/main/styles/<port-name>
@version 0.0.1
@updateURL https://github.com/catppuccin/userstyles/raw/main/styles/<port name>/catppuccin.user.css
@supportURL https://github.com/catppuccin/userstyles/issues?q=is%3Aopen+is%3Aissue+label%3A<port name>
@description Soothing pastel theme for <port name>
@updateURL https://github.com/catppuccin/userstyles/raw/main/styles/<port-name>/catppuccin.user.css
@supportURL https://github.com/catppuccin/userstyles/issues?q=is%3Aopen+is%3Aissue+label%3A<port-name>
@description Soothing pastel theme for <port-name>
@author Catppuccin
@license MIT
@@ -16,10 +16,8 @@
==/UserStyle== */
/* If you need any help with the information above, please see: https://github.com/openstyles/stylus/wiki/Writing-UserCSS#var */
/* Apply Theme To Site
* For help with URL rules, please see https://github.com/openstyles/stylus/wiki/Writing-styles#valid--moz-document-rules */
@-moz-document regexp('<URL>') {
// Palette Lookup Table
/* For help with URL rules, please see https://github.com/openstyles/stylus/wiki/Writing-styles#valid--moz-document-rules. */
@-moz-document domain('<website-domain>') {
/* prettier-ignore */
@catppuccin: {
@latte: { @rosewater: #dc8a78; @flamingo: #dd7878; @pink: #ea76cb; @mauve: #8839ef; @red: #d20f39; @maroon: #e64553; @peach: #fe640b; @yellow: #df8e1d; @green: #40a02b; @teal: #179299; @sky: #04a5e5; @sapphire: #209fb5; @blue: #1e66f5; @lavender: #7287fd; @text: #4c4f69; @subtext1: #5c5f77; @subtext0: #6c6f85; @overlay2: #7c7f93; @overlay1: #8c8fa1; @overlay0: #9ca0b0; @surface2: #acb0be; @surface1: #bcc0cc; @surface0: #ccd0da; @base: #eff1f5; @mantle: #e6e9ef; @crust: #dce0e8; };
@@ -28,12 +26,7 @@
@mocha: { @rosewater: #f5e0dc; @flamingo: #f2cdcd; @pink: #f5c2e7; @mauve: #cba6f7; @red: #f38ba8; @maroon: #eba0ac; @peach: #fab387; @yellow: #f9e2af; @green: #a6e3a1; @teal: #94e2d5; @sky: #89dceb; @sapphire: #74c7ec; @blue: #89b4fa; @lavender: #b4befe; @text: #cdd6f4; @subtext1: #bac2de; @subtext0: #a6adc8; @overlay2: #9399b2; @overlay1: #7f849c; @overlay0: #6c7086; @surface2: #585b70; @surface1: #45475a; @surface0: #313244; @base: #1e1e2e; @mantle: #181825; @crust: #11111b; };
}
/* Userstyle as Mixin
* This takes the following Parameters:
* @lookup – which is the desired Flavor
* @accent – which is the desired Accent Color */
#catppuccin(@lookup, @accent) {
// unpacking the color codes from the current @lookup flavor
@rosewater: @catppuccin[@@lookup][@rosewater];
@flamingo: @catppuccin[@@lookup][@flamingo];
@pink: @catppuccin[@@lookup][@pink];
@@ -62,7 +55,7 @@
@crust: @catppuccin[@@lookup][@crust];
@accent-color: @catppuccin[@@lookup][@@accent];
// now colors can be used with their regular names
// Start styling your website here:
background-color: @base;
/* If you need to specify an overwrite specific to a Flavor
@@ -78,29 +71,31 @@
}
}
/* Application of the Theme
* The values below are examples and may need to be adapted.
* To apply the correct Theming call the above defined Mixin and pass
* your desired Flavor and Accent Color to it. These are usually
* populated through the @vars in the Meta Block. */
// synced colorscheme
/* This section applies the light/dark themes automatically based on the user's system theme.
Uncomment this *only* if the website you are theming doesn't have a light/dark mode toggle.
For an actual example of this, see https://github.com/catppuccin/userstyles/blob/39288b593278e5efa48007d5fc001292cf910672/styles/brave-search/catppuccin.user.css#L16-L29.
@media (prefers-color-scheme: light) {
.no-theme {
:root {
#catppuccin(@lightFlavor, @accentColor);
}
}
@media (prefers-color-scheme: dark) {
.no-theme {
:root {
#catppuccin(@darkFlavor, @accentColor);
}
}
*/
// manually set colorscheme
.light-theme {
/* If the website you are theming *does* have a light/dark mode toggle,
you can conditionally enable light/dark flavors by targeting whatever attribute that website uses to indicate the theme.
Un-comment this block if that is the case.
For an actual example of this, see https://github.com/catppuccin/userstyles/blob/39288b593278e5efa48007d5fc001292cf910672/styles/youtube/catppuccin.user.css#L21-L30.
:root[data-theme="dark"] {
#catppuccin(@lightFlavor, @accentColor);
}
.dark-theme {
:root[data-theme="light"] {
#catppuccin(@darkFlavor, @accentColor);
}
*/
}
// vim:ft=less