catppuccin-palette/scss/README.md
winston aaa247a499
docs(sass): mention sass syntax weirdness
Co-authored-by: sgoudham <sgoudham@gmail.com>
2022-08-14 04:08:22 +02:00

78 lines
1.4 KiB
Markdown

# Catppuccin Sass
There are two ways of using these Sass files:
## Import one-by-one
The easiest way to import a single flavour, is to use one of these 4 files:\
`_latte.scss`, `_frappe.scss`, `_macchiato.scss`, `_mocha.scss`
Input:
```scss
@import "mocha";
.my-mocha-class {
background: $base;
color: $text;
}
```
Output:
```css
.my-mocha-class {
background: #1e1e2e;
color: #cdd6f4;
}
```
## Import the single-map file
Another way to create all four flavours, in a single file, from a single file,
is to use `_catppuccin.scss`.
**NB**: Due to websafe colours being predefined in CSS, colours like `red`, `green`, `blue` will **not** be generated with this method, **when they are not** explicitly cast as a string. To ensure proper generation, wrap your values with `'`.
In short:\
❌ Don't do this:
`#{map-get($color, blue)}`\
✅ Do this:
`#{map-get($color, 'blue')}`
Input:
```scss
@use "catppuccin";
@each $flavour, $colour in catppuccin.$palette {
.my-#{flavour}-class {
// you need surround the catppuccin colour names with quotes
background: map-get($colour, 'base');
color: map-get($colour, 'blue');
}
}
```
Output:
```css
.my-mocha-class {
background: #1e1e2e;
color: #cdd6f4;
}
.my-macchiato-class {
background: #24273a;
color: #cad3f5;
}
.my-frappe-class {
background: #303446;
color: #c6d0f5;
}
.my-latte-class {
background: #eff1f5;
color: #4c4f69;
}
```