Skip to content

Commit c1550f3

Browse files
authoredNov 8, 2022
feat: rename 'theme' to 'flavour' to keep consistency (#7)
* refactor: Rename 'theme' to 'flavour' * fix: Make `Theme` a type alias of `Flavour`
1 parent b1cd261 commit c1550f3

File tree

8 files changed

+71
-68
lines changed

8 files changed

+71
-68
lines changed
 

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
1. `go get github.com/catppuccin/go`
1919
2. Add an`import catppuccin "github.com/catppuccin/go"` to your file
20-
3. Use the theme variants as you wish.
20+
3. Use the flavours as you wish.
2121

2222
## 🙋 FAQ (optional)
2323

‎_examples/main.go

+28-28
Original file line numberDiff line numberDiff line change
@@ -9,45 +9,45 @@ import (
99

1010
func main() {
1111
fmt.Println()
12-
for _, theme := range []catppuccin.Theme{
12+
for _, flavour := range []catppuccin.Flavour{
1313
catppuccin.Mocha(),
1414
catppuccin.Frappe(),
1515
catppuccin.Macchiato(),
1616
catppuccin.Latte(),
1717
} {
1818

19-
fmt.Println(lipgloss.NewStyle().Bold(true).Render(theme.Name() + ":"))
20-
format("rosewater", theme.Rosewater(), theme.Base())
21-
format("flamingo", theme.Flamingo(), theme.Base())
22-
format("pink", theme.Pink(), theme.Base())
23-
format("mauve", theme.Mauve(), theme.Base())
24-
format("red", theme.Red(), theme.Base())
19+
fmt.Println(lipgloss.NewStyle().Bold(true).Render(flavour.Name() + ":"))
20+
format("rosewater", flavour.Rosewater(), flavour.Base())
21+
format("flamingo", flavour.Flamingo(), flavour.Base())
22+
format("pink", flavour.Pink(), flavour.Base())
23+
format("mauve", flavour.Mauve(), flavour.Base())
24+
format("red", flavour.Red(), flavour.Base())
2525
fmt.Println()
26-
format("maroon", theme.Maroon(), theme.Base())
27-
format("peach", theme.Peach(), theme.Base())
28-
format("yellow", theme.Yellow(), theme.Base())
29-
format("green", theme.Green(), theme.Base())
30-
format("teal", theme.Teal(), theme.Base())
26+
format("maroon", flavour.Maroon(), flavour.Base())
27+
format("peach", flavour.Peach(), flavour.Base())
28+
format("yellow", flavour.Yellow(), flavour.Base())
29+
format("green", flavour.Green(), flavour.Base())
30+
format("teal", flavour.Teal(), flavour.Base())
3131
fmt.Println()
32-
format("sky", theme.Sky(), theme.Base())
33-
format("sapphire", theme.Sapphire(), theme.Base())
34-
format("blue", theme.Blue(), theme.Base())
35-
format("lavender", theme.Lavender(), theme.Base())
36-
format("text", theme.Text(), theme.Base())
32+
format("sky", flavour.Sky(), flavour.Base())
33+
format("sapphire", flavour.Sapphire(), flavour.Base())
34+
format("blue", flavour.Blue(), flavour.Base())
35+
format("lavender", flavour.Lavender(), flavour.Base())
36+
format("text", flavour.Text(), flavour.Base())
3737
fmt.Println()
38-
format("subtext1", theme.Subtext1(), theme.Base())
39-
format("subtext0", theme.Subtext0(), theme.Base())
40-
format("overlay2", theme.Overlay2(), theme.Base())
41-
format("overlay1", theme.Overlay1(), theme.Base())
42-
format("overlay0", theme.Overlay0(), theme.Text())
38+
format("subtext1", flavour.Subtext1(), flavour.Base())
39+
format("subtext0", flavour.Subtext0(), flavour.Base())
40+
format("overlay2", flavour.Overlay2(), flavour.Base())
41+
format("overlay1", flavour.Overlay1(), flavour.Base())
42+
format("overlay0", flavour.Overlay0(), flavour.Text())
4343
fmt.Println()
44-
format("surface2", theme.Surface2(), theme.Text())
45-
format("surface1", theme.Surface1(), theme.Text())
46-
format("surface0", theme.Surface0(), theme.Text())
47-
format("crust", theme.Crust(), theme.Text())
48-
format("mantle", theme.Mantle(), theme.Text())
44+
format("surface2", flavour.Surface2(), flavour.Text())
45+
format("surface1", flavour.Surface1(), flavour.Text())
46+
format("surface0", flavour.Surface0(), flavour.Text())
47+
format("crust", flavour.Crust(), flavour.Text())
48+
format("mantle", flavour.Mantle(), flavour.Text())
4949
fmt.Println()
50-
format("base", theme.Base(), theme.Text())
50+
format("base", flavour.Base(), flavour.Text())
5151
fmt.Println()
5252
fmt.Println()
5353
}

‎frappe.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package catppuccingo
33
// frappe variant.
44
type frappe struct{}
55

6-
// Frappe theme variant.
7-
var Frappe Theme = frappe{}
6+
// Frappe flavour variant.
7+
var Frappe Flavour = frappe{}
88

99
func (frappe) Name() string { return "frappe" }
1010

‎latte.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package catppuccingo
33
// latte variant.
44
type latte struct{}
55

6-
// Latte theme variant.
7-
var Latte Theme = latte{}
6+
// Latte flavour variant.
7+
var Latte Flavour = latte{}
88

99
func (latte) Name() string { return "latte" }
1010

‎macchiato.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package catppuccingo
33
// macchiato variant.
44
type macchiato struct{}
55

6-
// Macchiato theme variant.
7-
var Macchiato Theme = macchiato{}
6+
// Macchiato flavour variant.
7+
var Macchiato Flavour = macchiato{}
88

99
func (macchiato) Name() string { return "macchiato" }
1010

‎main.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ package catppuccingo
22

33
import "image/color"
44

5-
// Theme is an interface implemented by all Catppuccin variations.
6-
type Theme interface {
5+
// Flavour is an interface implemented by all Catppuccin variations.
6+
type Flavour interface {
77
Rosewater() Color
88
Flamingo() Color
99
Pink() Color
@@ -33,6 +33,9 @@ type Theme interface {
3333
Name() string
3434
}
3535

36+
// Theme is a type alias of Flavour to keep compatibility with previous versions.
37+
type Theme = Flavour
38+
3639
// Color is a color in Hex, RGB, and HSL.
3740
type Color struct {
3841
Hex string

‎main_test.go

+29-29
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,40 @@ import (
44
"testing"
55
)
66

7-
func TestThemes(t *testing.T) {
8-
for _, theme := range []Theme{
7+
func TestFlavours(t *testing.T) {
8+
for _, flavour := range []Flavour{
99
Mocha,
1010
Frappe,
1111
Macchiato,
1212
Latte,
1313
} {
14-
t.Run(theme.Name(), func(t *testing.T) {
15-
requireNotEmpty(t, theme.Rosewater())
16-
requireNotEmpty(t, theme.Flamingo())
17-
requireNotEmpty(t, theme.Pink())
18-
requireNotEmpty(t, theme.Mauve())
19-
requireNotEmpty(t, theme.Red())
20-
requireNotEmpty(t, theme.Maroon())
21-
requireNotEmpty(t, theme.Peach())
22-
requireNotEmpty(t, theme.Yellow())
23-
requireNotEmpty(t, theme.Green())
24-
requireNotEmpty(t, theme.Teal())
25-
requireNotEmpty(t, theme.Sky())
26-
requireNotEmpty(t, theme.Sapphire())
27-
requireNotEmpty(t, theme.Blue())
28-
requireNotEmpty(t, theme.Lavender())
29-
requireNotEmpty(t, theme.Text())
30-
requireNotEmpty(t, theme.Subtext1())
31-
requireNotEmpty(t, theme.Subtext0())
32-
requireNotEmpty(t, theme.Overlay2())
33-
requireNotEmpty(t, theme.Overlay1())
34-
requireNotEmpty(t, theme.Overlay0())
35-
requireNotEmpty(t, theme.Surface2())
36-
requireNotEmpty(t, theme.Surface1())
37-
requireNotEmpty(t, theme.Surface0())
38-
requireNotEmpty(t, theme.Crust())
39-
requireNotEmpty(t, theme.Mantle())
40-
requireNotEmpty(t, theme.Base())
14+
t.Run(flavour.Name(), func(t *testing.T) {
15+
requireNotEmpty(t, flavour.Rosewater())
16+
requireNotEmpty(t, flavour.Flamingo())
17+
requireNotEmpty(t, flavour.Pink())
18+
requireNotEmpty(t, flavour.Mauve())
19+
requireNotEmpty(t, flavour.Red())
20+
requireNotEmpty(t, flavour.Maroon())
21+
requireNotEmpty(t, flavour.Peach())
22+
requireNotEmpty(t, flavour.Yellow())
23+
requireNotEmpty(t, flavour.Green())
24+
requireNotEmpty(t, flavour.Teal())
25+
requireNotEmpty(t, flavour.Sky())
26+
requireNotEmpty(t, flavour.Sapphire())
27+
requireNotEmpty(t, flavour.Blue())
28+
requireNotEmpty(t, flavour.Lavender())
29+
requireNotEmpty(t, flavour.Text())
30+
requireNotEmpty(t, flavour.Subtext1())
31+
requireNotEmpty(t, flavour.Subtext0())
32+
requireNotEmpty(t, flavour.Overlay2())
33+
requireNotEmpty(t, flavour.Overlay1())
34+
requireNotEmpty(t, flavour.Overlay0())
35+
requireNotEmpty(t, flavour.Surface2())
36+
requireNotEmpty(t, flavour.Surface1())
37+
requireNotEmpty(t, flavour.Surface0())
38+
requireNotEmpty(t, flavour.Crust())
39+
requireNotEmpty(t, flavour.Mantle())
40+
requireNotEmpty(t, flavour.Base())
4141
})
4242
}
4343
}

‎mocha.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ package catppuccingo
22

33
type mocha struct{}
44

5-
// Mocha theme variant.
6-
var Mocha Theme = mocha{}
5+
// Mocha flavour variant.
6+
var Mocha Flavour = mocha{}
77

88
func (mocha) Name() string { return "mocha" }
99

0 commit comments

Comments
 (0)
Please sign in to comment.