Skip to content

Commit

Permalink
fetch and parse paletts
Browse files Browse the repository at this point in the history
  • Loading branch information
MAHcodes committed Apr 18, 2024
0 parents commit ef3235e
Show file tree
Hide file tree
Showing 20 changed files with 1,275 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: test

on:
push:
branches:
- master
- main
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
with:
otp-version: "26.0.2"
gleam-version: "1.1.0"
rebar3-version: "3"
# elixir-version: "1.15.4"
- run: gleam deps download
- run: gleam test
- run: gleam format --check src test
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.beam
*.ez
/build
erl_crash.dump
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<h3 align="center">
<img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/logos/exports/1544x1544_circle.png" width="100" alt="Logo"/><br/>
<img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/misc/transparent.png" height="30" width="0px"/>
Catppuccin for <a href="https://github.com/gleam-lang/gleam">Gleam</a>
<img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/misc/transparent.png" height="30" width="0px"/>
</h3>

<p align="center">
<a href="https://github.com/catppuccin/gleam/stargazers"><img src="https://img.shields.io/github/stars/catppuccin/gleam?colorA=363a4f&colorB=b7bdf8&style=for-the-badge"></a>
<a href="https://github.com/catppuccin/gleam/issues"><img src="https://img.shields.io/github/issues/catppuccin/gleam?colorA=363a4f&colorB=f5a97f&style=for-the-badge"></a>
<a href="https://github.com/catppuccin/gleam/contributors"><img src="https://img.shields.io/github/contributors/catppuccin/gleam?colorA=363a4f&colorB=a6da95&style=for-the-badge"></a>
</p>

## Usage

```sh
gleam add catppuccin
```
```gleam
import catppuccin
import catppuccin/mocha
import gleam/io
pub fn main() {
// access the value directly
mocha.blue.rgb.r
|> io.debug // 137
// or access the value using the built-in methods
mocha.lavender
|> catppuccin.to_hex
|> io.debug // #b4befe
}
```


<!-- this section is optional -->
## 🙋 FAQ

- Q: **_"Where can I find the doc?"_**\
A: Further documentation can be found at <https://hexdocs.pm/catppuccin>.

## 💝 Thanks to

- [MAHcodes](https://github.com/MAHcodes)

&nbsp;

<p align="center">
<img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/footers/gray0_ctp_on_line.svg?sanitize=true" />
</p>

<p align="center">
Copyright &copy; 2021-present <a href="https://github.com/catppuccin" target="_blank">Catppuccin Org</a>
</p>

<p align="center">
<a href="https://github.com/catppuccin/catppuccin/blob/main/LICENSE"><img src="https://img.shields.io/static/v1.svg?style=for-the-badge&label=License&message=MIT&logoColor=d9e0ee&colorA=363a4f&colorB=b7bdf8"/></a>
</p>
22 changes: 22 additions & 0 deletions gleam.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name = "catppuccin"
version = "1.0.0"

# Fill out these fields if you intend to generate HTML documentation or publish
# your project to the Hex package manager.
#
# description = ""
# licences = ["Apache-2.0"]
# repository = { type = "github", user = "username", repo = "project" }
# links = [{ title = "Website", href = "https://gleam.run" }]
#
# For a full reference of all the available options, you can have a look at
# https://gleam.run/writing-gleam/gleam-toml/.

[dependencies]
gleam_stdlib = ">= 0.34.0 and < 2.0.0"
gleam_httpc = ">= 2.2.0 and < 3.0.0"
gleam_http = ">= 3.6.0 and < 4.0.0"
gleam_json = ">= 1.0.0 and < 2.0.0"

[dev-dependencies]
gleeunit = ">= 1.0.0 and < 2.0.0"
23 changes: 23 additions & 0 deletions lib/.github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: test

on:
push:
branches:
- master
- main
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
with:
otp-version: "26.0.2"
gleam-version: "1.1.0"
rebar3-version: "3"
# elixir-version: "1.15.4"
- run: gleam deps download
- run: gleam test
- run: gleam format --check src test
4 changes: 4 additions & 0 deletions lib/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.beam
*.ez
/build
erl_crash.dump
21 changes: 21 additions & 0 deletions lib/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 MAH

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
36 changes: 36 additions & 0 deletions lib/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# catppuccin

[![Package Version](https://img.shields.io/hexpm/v/catppuccin)](https://hex.pm/packages/catppuccin)
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/catppuccin/)

⭐️ Soothing pastel library for Gleam

```sh
gleam add catppuccin
```
```gleam
import catppuccin
import catppuccin/mocha
import gleam/io
pub fn main() {
// access the value directly
mocha.blue.rgb.r
|> io.debug // 137
// or access the value using the built-in methods
mocha.lavender
|> catppuccin.to_hex
|> io.debug // #b4befe
}
```

Further documentation can be found at <https://hexdocs.pm/catppuccin>.

## Development

```sh
gleam run # Run the project
gleam test # Run the tests
gleam shell # Run an Erlang shell
```
13 changes: 13 additions & 0 deletions lib/gleam.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name = "catppuccin"
version = "1.0.0"

description = "⭐️ Soothing pastel library for Gleam"
licences = ["MIT"]
repository = { type = "github", user = "MAHcodes", repo = "catppuccin" }
links = [{ title = "Author", href = "https://github.com/MAHcodes" }]

[dependencies]
gleam_stdlib = ">= 0.34.0 and < 2.0.0"

[dev-dependencies]
gleeunit = ">= 1.0.0 and < 2.0.0"
11 changes: 11 additions & 0 deletions lib/manifest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This file was generated by Gleam
# You typically do not need to edit this file

packages = [
{ name = "gleam_stdlib", version = "0.36.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "C0D14D807FEC6F8A08A7C9EF8DFDE6AE5C10E40E21325B2B29365965D82EB3D4" },
{ name = "gleeunit", version = "1.1.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "72CDC3D3F719478F26C4E2C5FED3E657AC81EC14A47D2D2DEBB8693CA3220C3B" },
]

[requirements]
gleam_stdlib = { version = ">= 0.34.0 and < 2.0.0" }
gleeunit = { version = ">= 1.0.0 and < 2.0.0" }
26 changes: 26 additions & 0 deletions lib/src/catppuccin.gleam
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
pub type Hex =
String

pub type RGB {
RGB(r: Int, g: Int, b: Int)
}

pub type HSL {
HSL(h: Int, s: Float, l: Float)
}

pub type Color {
Color(hex: Hex, rgb: RGB, hsl: HSL)
}

pub fn to_hex(color: Color) -> Hex {
color.hex
}

pub fn to_rgb(color: Color) -> RGB {
color.rgb
}

pub fn to_hsl(color: Color) -> HSL {
color.hsl
}
Loading

0 comments on commit ef3235e

Please sign in to comment.