You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Install with `pip` or your preferred dependency management tool.
17
17
18
-
```bash
19
-
pip install catppuccin
20
-
```
21
-
22
-
## Usage
23
-
24
-
Get access to the palette with the `catppuccin.PALETTE` constant:
25
-
26
-
```python
27
-
from catppuccin importPALETTE
28
-
29
-
PALETTE.latte.colors.mauve.hex
30
-
# '#8839ef'
31
-
PALETTE.mocha.colors.teal.rgb
32
-
# RGB(r=148, g=226, b=213)
33
-
```
34
-
35
-
The `Palette` data structure matches [the palette JSON](https://github.com/catppuccin/palette/blob/main/palette.json).
36
-
37
-
### Iteration
38
-
39
-
Both `Palette` and `FlavorColors` can be iterated to yield flavors and colors respectively:
40
-
41
-
```python
42
-
for flavor inPALETTE:
43
-
print(flavor.name)
44
-
45
-
# Latte
46
-
# Frappé
47
-
# Macchiato
48
-
# Mocha
49
-
50
-
for color inPALETTE.latte.colors:
51
-
print(f"{color.name}: {color.hex}")
52
-
53
-
# Rosewater: #f2d5cf
54
-
# Flamingo: #eebebe
55
-
# Pink: #f4b8e4
56
-
# ...
57
-
# Base: #303446
58
-
# Mantle: #292c3c
59
-
# Crust: #232634
60
-
```
61
-
62
-
### dataclasses
63
-
64
-
`Palette`, `Flavor`, `Color` et cetera are all [`dataclasses`](https://docs.python.org/3/library/dataclasses.html),
65
-
so you can also inspect and iterate their fields using methods from the dataclass module.
66
-
67
-
For example, to list all color names and their hex codes:
68
-
69
-
```python
70
-
from dataclasses import fields
71
-
from catppuccin importPALETTE
72
-
73
-
flavor =PALETTE.frappe
74
-
for field in fields(flavor.colors):
75
-
color =getattr(flavor.colors, field.name)
76
-
print(f"{field.name}: {color.hex}")
77
-
78
-
# rosewater: #f2d5cf
79
-
# flamingo: #eebebe
80
-
# pink: #f4b8e4
81
-
# ...
82
-
# base: #303446
83
-
# mantle: #292c3c
84
-
# crust: #232634
85
18
```
86
-
87
-
## Pygments Styles
88
-
89
-
This package provides a Pygments style for each of the four Catppuccin flavors.
90
-
91
-
Install Catppuccin with the `pygments` feature to include the relevant dependencies:
92
-
93
-
```bash
94
-
pip install catppuccin[pygments]
95
-
```
96
-
97
-
The styles are registered as importlib entrypoints, which allows Pygments to
98
-
find them by name:
99
-
100
-
```python
101
-
from pygments.styles import get_style_by_name
102
-
103
-
get_style_by_name("catppuccin-frappe")
104
-
# catppuccin.extras.pygments.FrappeStyle
19
+
pip install catppuccin
105
20
```
106
21
107
-
The following style names are available:
108
-
109
-
-`catppuccin-latte`
110
-
-`catppuccin-frappe`
111
-
-`catppuccin-macchiato`
112
-
-`catppuccin-mocha`
22
+
## Documentation
113
23
114
-
They can also be accessed by directly importing them:
24
+
For API documentation and usage examples, [see our online documentation](https://python.catppuccin.com/docs).
115
25
116
-
```python
117
-
from catppuccin.extras.pygments import MacchiatoStyle
118
-
```
119
-
120
-
### IPython
26
+
## IPython Theme
121
27
122
28
A minimal configuration:
123
29
@@ -131,65 +37,12 @@ and ensuring `catppuccin[pygments]` is installed in the same environment will
131
37
give you Catppuccin Mocha syntax highlighting in the REPL. See [here](https://github.com/backwardspy/dots/blob/f6991570d6691212e27e266517656192f910ccbf/dot_config/ipython/profile_default/ipython_config.py)
132
38
for an example of a more complete configuration.
133
39
134
-
## Matplotlib
135
-
136
-
The library tries to register styles and colormaps if `matplotlib` is installed.
0 commit comments