Skip to content

Commit

Permalink
v2.0.0
Browse files Browse the repository at this point in the history
- more functional (check the example in the readme)
- use opaque types
- remove unnecessary complexity (colour_result) assuming
  `palette.json` will never provide wrong rgb values (hopefully)
  • Loading branch information
MAHcodes committed Apr 21, 2024
1 parent 3847045 commit 3d2f2a9
Show file tree
Hide file tree
Showing 9 changed files with 1,160 additions and 1,215 deletions.
29 changes: 18 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,35 @@ gleam add catppuccin
## 🚀 Usage

```gleam
import catppuccin/frappe
import catppuccin
import gleam/io
import gleam_community/colour
pub fn main() {
frappe.name
catppuccin.frappe()
|> catppuccin.flavour_name
|> io.debug
// "Frappé"
frappe.mauve().name
catppuccin.macchiato()
|> catppuccin.subtext1
|> catppuccin.color_name
|> io.debug
// "Mauve"
// "Subtext 1"
frappe.mauve().colour
catppuccin.mocha()
|> catppuccin.mauve
|> catppuccin.to_colour
|> colour.to_rgba
|> io.debug
// #(0.792156862745098, 0.6196078431372549, 0.9019607843137255, 1.0)
// #(0.796078431372549, 0.6509803921568628, 0.9686274509803922, 1.0)
frappe.mauve().colour
|> colour.to_css_rgba_string
catppuccin.latte()
|> catppuccin.mauve
|> catppuccin.to_colour
|> colour.to_hsla
|> io.debug
// "rgba(79.22%,61.96%,90.2%,1.0)"
// #(0.739010989010989, 0.8504672897196262, 0.5803921568627451, 1.0)
}
```

Expand All @@ -57,7 +64,7 @@ pub fn main() {

## 🛠️ Development

The project under `codegen` directory is used to generate library files based on the contents of [palette.json](https://raw.githubusercontent.com/catppuccin/palette/main/palette.json).
The project under `codegen` directory is used to generate the library based on the contents of [palette.json](https://raw.githubusercontent.com/catppuccin/palette/main/palette.json).

1. Clone this repository locally
```sh
Expand All @@ -73,7 +80,7 @@ The project under `codegen` directory is used to generate library files based on
```
4. Replace the generated files
```sh
mv -iv catppuccin/* ../src/catppuccin
mv -iv out/catppuccin.gleam ../src/
```

## 💝 Thanks to
Expand Down
26 changes: 17 additions & 9 deletions codegen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,37 @@
```sh
gleam add catppuccin
```

```gleam
import catppuccin/frappe
import catppuccin
import gleam/io
import gleam_community/colour
pub fn main() {
frappe.name
catppuccin.frappe()
|> catppuccin.flavour_name
|> io.debug
// "Frappé"
frappe.mauve().name
catppuccin.macchiato()
|> catppuccin.subtext1
|> catppuccin.color_name
|> io.debug
// "Mauve"
// "Subtext 1"
frappe.mauve().colour
catppuccin.mocha()
|> catppuccin.mauve
|> catppuccin.to_colour
|> colour.to_rgba
|> io.debug
// #(0.792156862745098, 0.6196078431372549, 0.9019607843137255, 1.0)
// #(0.796078431372549, 0.6509803921568628, 0.9686274509803922, 1.0)
frappe.mauve().colour
|> colour.to_css_rgba_string
catppuccin.latte()
|> catppuccin.mauve
|> catppuccin.to_colour
|> colour.to_hsla
|> io.debug
// "rgba(79.22%,61.96%,90.2%,1.0)"
// #(0.739010989010989, 0.8504672897196262, 0.5803921568627451, 1.0)
}
```

Expand Down
Loading

0 comments on commit 3d2f2a9

Please sign in to comment.