docs: add sections on dev enviroment setup, auto-generated classes, draft PRs, less mixins, syntax highlighting, mention tips and tricks page (#866)
This commit is contained in:
1 parent
e329082642
commit
cea21f650a
6 files changed
+78
-17
No files matched your search
+16
-8
@@ -8,24 +8,30 @@ The following is a set of guidelines for contributing to this repository. Use
|
||||
your best judgment, and feel free to propose changes to this document in a pull
|
||||
request.
|
||||
|
||||
## Types of PRs
|
||||
> [!IMPORTANT]
|
||||
> For new userstyles, make sure to see [userstyle-creation.md](./userstyle-creation.md) after reading this.
|
||||
|
||||
It is important to note that there are **two types of PRs** for this repository:
|
||||
## Development environment
|
||||
|
||||
1. **New Userstyles:** Please see [userstyle-creation.md](./userstyle-creation.md).
|
||||
2. **Other improvements:** These should follow the recommendations below, to help improve the chances of a merged PR.
|
||||
This repositories uses [Deno](https://deno.com/) extensively for linting and automation. We recommend setting up Deno locally to improve your workflow — see ["Installation" - Deno Docs](https://docs.deno.com/runtime/manual/getting_started/installation). With Deno installed locally, you can run the lint script using `deno task lint` (and `deno task lint:fix` to automatically apply fixes) and the formatting script using `deno task format`.
|
||||
|
||||
When editing a userstyle, we suggest setting up live reloading so your local changes can be automatically reloaded through Stylus. See ["How can I see my changes in real time?"](./tips-and-tricks.md#how-can-i-see-my-changes-in-real-time).
|
||||
|
||||
## Recommendations
|
||||
|
||||
### Root Variables
|
||||
### Assessing websites
|
||||
|
||||
Some websites are, unfortunately, simply not meant for userstyles. For example, websites that have auto-generated classes (`aeN WR beA nH oy8Mbf`, `cfb2a888`, etc.) lead to unreadable and unmaintainable userstyles — they break quickly and are difficult for contributors besides the maintainer to update/maintain. For those reasons we recommend not attempting to theme such sites.
|
||||
|
||||
### Root variables
|
||||
|
||||
While writing a userstyle, you may have come across [custom properties / CSS variables](https://developer.mozilla.org/en-US/docs/Web/CSS/--*), typically wrapped in a `:root` selector. We refer to these variables as "root variables", and they can be thought of as global variables used all across a website. For Catppuccin userstyles, we prefer that these variables are themed (if they exist) rather than individual elements. As the website hopefully uses these variables themselves, it saves yourself a lot of work in theming and maintaining the userstyle.
|
||||
|
||||
### Opinionated Changes
|
||||
### Opinionated changes
|
||||
|
||||
When writing or updating a userstyle, it is important to keep in mind that different users have different preferences. To avoid lengthy discussion over user interface aesthetics, we have a set of rules for what a userstyle may include; importantly, **changes to font or layout (padding, margin, hiding/moving elements) are prohibited.**
|
||||
|
||||
### General Recommendations
|
||||
### General recommendations
|
||||
|
||||
- Create a [topic branch](https://git-scm.com/book/en/v2/Git-Branching-Branching-Workflows#_topic_branch) on your fork for your specific PR.
|
||||
- Catppuccin uses the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)
|
||||
@@ -41,7 +47,9 @@ When writing or updating a userstyle, it is important to keep in mind that diffe
|
||||
any questions and clarify your understanding, we are more than happy to help!
|
||||
- Changes to docs may need to use [marksman](https://github.com/artempyanykh/marksman) to generate the table of contents.
|
||||
|
||||
## Pull Request Review Process
|
||||
## Pull request review process
|
||||
|
||||
It's better to have a draft pull request than no pull request at all. Having a draft lets others know that a userstyle is being worked on, and gives the opportunity for people to try it out ahead of time (if they really want it themed!).
|
||||
|
||||
```mermaid
|
||||
graph TD;
|
||||
|
||||
+2
-4
@@ -17,8 +17,6 @@
|
||||
| Microsoft Edge | `edge://version/` |
|
||||
| Arc | `arc://version/` |
|
||||
|
||||
## Common Issues
|
||||
## Common issues
|
||||
|
||||
> [!NOTE]
|
||||
> If you are running into any compatibility issues with your browser, please consider opening
|
||||
> a pull request and documenting your issue here!
|
||||
If you are running into any compatibility issues with your browser, please feel free to open an issue!
|
||||
@@ -92,6 +92,9 @@ This section of the template is about applying the user's light/dark flavors. Re
|
||||
|
||||
### The `#catppuccin` mixin
|
||||
|
||||
> [!TIP]
|
||||
> For more on how Less mixins work, see ["Mixins" - lesscss.org](https://lesscss.org/features/#mixins-feature) and ["A Comprehensive Introduction to Less: Mixins" - SitePoint](https://www.sitepoint.com/a-comprehensive-introduction-to-less-mixins/).
|
||||
|
||||
We'll refer to this next section of the template as the "`#catppuccin` mixin". You can ignore the first half of this section with all of the `@<color>: @catppuccin[@@lookup][@<color>];` lines and skip to the comment where it says `// Start styling your website here:`. As the comment suggests, you will write the CSS rules for your port here. Here is what it looks like for our `example.org` port:
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
- [`<img>` elements](#img-elements)
|
||||
- [How do I set a variable to RGB values?](#how-do-i-set-a-variable-to-rgb-values)
|
||||
- [How can I inspect hard-to-grab elements?](#how-can-i-inspect-hard-to-grab-elements)
|
||||
- [How do I theme code blocks / syntax highlighting?](#how-do-i-theme-code-blocks--syntax-highlighting)
|
||||
<!--toc:end-->
|
||||
|
||||
### How can I see my changes in real time?
|
||||
@@ -156,3 +157,50 @@ setTimeout(function () {
|
||||

|
||||
|
||||
<span>Gif via <a href="https://css-tricks.com/set-timed-debugger-web-inspect-hard-grab-elements/">"Set a Timed Debugger To Web Inspect Hard-To-Grab Elements" - CSS Tricks</a>.</span>
|
||||
|
||||
### How do I theme code blocks / syntax highlighting?
|
||||
|
||||
If a website uses [highlight.js](https://highlightjs.org/) or [Pygments](https://pygments.org/) for syntax highlighting, add the corresponding line from below beneath the `@-moz-document` line to import our existing port.
|
||||
|
||||
**highlight.js**:
|
||||
|
||||
```css
|
||||
@import url("https://unpkg.com/@catppuccin/[email protected]/css/catppuccin.variables.css");
|
||||
```
|
||||
|
||||
**Pygments**:
|
||||
|
||||
```css
|
||||
@import url("https://python.catppuccin.com/pygments/catppuccin-variables.important.css");
|
||||
```
|
||||
|
||||
You'll also need to add the following lines beneath the color definition section (`@<color>: @catppuccin[@@lookup][@<color>];`) in the `#catppuccin` mixin:
|
||||
|
||||
```css
|
||||
--ctp-rosewater: @rosewater;
|
||||
--ctp-flamingo: @flamingo;
|
||||
--ctp-pink: @pink;
|
||||
--ctp-mauve: @mauve;
|
||||
--ctp-red: @red;
|
||||
--ctp-maroon: @maroon;
|
||||
--ctp-peach: @peach;
|
||||
--ctp-yellow: @yellow;
|
||||
--ctp-green: @green;
|
||||
--ctp-teal: @teal;
|
||||
--ctp-sky: @sky;
|
||||
--ctp-sapphire: @sapphire;
|
||||
--ctp-blue: @blue;
|
||||
--ctp-lavender: @lavender;
|
||||
--ctp-text: @text;
|
||||
--ctp-subtext1: @subtext1;
|
||||
--ctp-subtext0: @subtext0;
|
||||
--ctp-overlay2: @overlay2;
|
||||
--ctp-overlay1: @overlay1;
|
||||
--ctp-overlay0: @overlay0;
|
||||
--ctp-surface2: @surface2;
|
||||
--ctp-surface1: @surface1;
|
||||
--ctp-surface0: @surface0;
|
||||
--ctp-base: @base;
|
||||
--ctp-mantle: @mantle;
|
||||
--ctp-crust: @crust;
|
||||
```
|
||||
@@ -12,11 +12,12 @@
|
||||
|
||||
<!--toc:start-->
|
||||
|
||||
- [Requesting Userstyles](#requesting-userstyles)
|
||||
- [Creating Userstyles](#creating-userstyles)
|
||||
- [Requesting userstyles](#requesting-userstyles)
|
||||
- [Creating userstyles](#creating-userstyles)
|
||||
|
||||
<!--toc:end-->
|
||||
|
||||
### Requesting Userstyles
|
||||
### Requesting userstyles
|
||||
|
||||
To request a website to be themed, please create a [Port Request](https://github.com/catppuccin/catppuccin/discussions/new?category=port-requests) discussion on [catppuccin/catppuccin](https://github.com/catppuccin/catppuccin). While this may seem odd, this ensures to keep all of our requests in one place and makes it easier for all people to request what they want without needing to learn what "Stylus" exactly is.
|
||||
|
||||
@@ -25,9 +26,9 @@ To request a website to be themed, please create a [Port Request](https://github
|
||||
|
||||
|
||||
|
||||
### Creating Userstyles
|
||||
### Creating userstyles
|
||||
|
||||
To create a userstyle, follow the instructions listed below:
|
||||
To create a userstyle, follow the instructions below. If you run into any difficulties or have any questions, please check our [Tips and tricks](./tips-and-tricks.md) page first.
|
||||
|
||||
1. Fork this repository.
|
||||
2. Create a new branch under the name `feat/<name-of-website>`, (e.g.
|
||||
|
||||
Reference in new issue
Block a user