Skip to content

Commit 01a343b

Browse files
authored
Legacy module (#6)
1 parent 1835759 commit 01a343b

File tree

15 files changed

+460
-3
lines changed

15 files changed

+460
-3
lines changed

README.md

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,38 @@ Then add all or only needed library module dependencies to your module level bui
4545
```
4646
dependencies {
4747
implementation 'com.github.ShiftHackZ.Catppuccin-Android-Library:palette:<VERSION>'
48+
implementation 'com.github.ShiftHackZ.Catppuccin-Android-Library:palette-legacy:<VERSION>'
4849
implementation 'com.github.ShiftHackZ.Catppuccin-Android-Library:compose:<VERSION>'
4950
implementation 'com.github.ShiftHackZ.Catppuccin-Android-Library:splashscreen:<VERSION>'
5051
}
5152
```
5253

5354
### Palette
5455

55-
Implements Catppuccin color palette: Catppuccin.Latte, Catppuccin.Frappe, Catppuccin.Macchiato, Catppuccin.Mocha.
56+
Implements Catppuccin color compose palette:
57+
- Catppuccin.Latte
58+
- Catppuccin.Frappe
59+
- Catppuccin.Macchiato
60+
- Catppuccin.Mocha
5661

5762
```
5863
implementation 'com.github.ShiftHackZ.Catppuccin-Android-Library:palette:<VERSION>'
5964
```
6065

66+
### Palette Legacy
67+
68+
**Available since version 0.1.1**
69+
70+
Implements Catppuccin color palette as xml resources and static colors that can be accessed without context:
71+
- CatppuccinLegacy.Latte
72+
- CatppuccinLegacy.Frappe
73+
- CatppuccinLegacy.Macchiato
74+
- CatppuccinLegacy.Mocha
75+
76+
```
77+
implementation 'com.github.ShiftHackZ.Catppuccin-Android-Library:palette-legacy:<VERSION>'
78+
```
79+
6180
### Compose
6281

6382
Implements Android Jetpack Compose Catppuccin material themes.
@@ -95,6 +114,40 @@ fun RedText(text: String) {
95114
}
96115
```
97116

117+
### Palette Legacy
118+
119+
To access a color in XML or programatically with context, use `catppuccin_<flavor>_<color>`:
120+
121+
```xml
122+
<View
123+
android:color="@color/catppuccin_frappe_sub_text_1"
124+
/>
125+
```
126+
127+
```xml
128+
<View
129+
android:color="@color/catppuccin_frappe_red"
130+
/>
131+
```
132+
133+
Or you can access it with context like this:
134+
135+
```kotlin
136+
import com.shifthackz.catppuccin.palette.legacy.R as CatppuccinRes
137+
138+
...
139+
val color = ContextCompat.getColor(context, CatppuccinRes.catppuccin_frappe_red)
140+
...
141+
142+
```
143+
144+
In case you need a color represented as Int value (or simply don't want to use context)
145+
you can access the color by call `CatppuccinLegacy.<Flavor>.<color>`:
146+
147+
```kotlin
148+
val color = CatppuccinLegacy.Frappe.red
149+
```
150+
98151
### Compose material themes
99152

100153
#### Themes overview

app/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ android {
4949
}
5050

5151
dependencies {
52+
implementation(project(":palette"))
53+
implementation(project(":palette-legacy"))
5254
implementation(project(":compose"))
5355
implementation(project(":splashscreen"))
5456

gradle/libs.versions.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[versions]
2-
catppuccin = "0.1.0"
2+
catppuccin = "0.1.1"
33
activityCompose = "1.8.2"
44
androidGradlePlugin = "8.2.0"
55
kotlin = "1.9.10"
@@ -12,7 +12,6 @@ lifecycleRuntimeKtx = "2.6.2"
1212
lifecycleCompose = "2.6.2"
1313
material3 = "1.1.2"
1414

15-
1615
[libraries]
1716
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "activityCompose" }
1817
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidxCoreKtx" }

palette-legacy/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

palette-legacy/build.gradle.kts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
plugins {
2+
alias(libs.plugins.android.library)
3+
alias(libs.plugins.org.jetbrains.kotlin.android)
4+
`maven-publish`
5+
}
6+
7+
android {
8+
namespace = "com.shifthackz.catppuccin.palette.legacy"
9+
compileSdk = 34
10+
11+
defaultConfig {
12+
minSdk = 21
13+
14+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
15+
consumerProguardFiles("consumer-rules.pro")
16+
}
17+
18+
buildTypes {
19+
release {
20+
isMinifyEnabled = false
21+
proguardFiles(
22+
getDefaultProguardFile("proguard-android-optimize.txt"),
23+
"proguard-rules.pro"
24+
)
25+
}
26+
}
27+
publishing {
28+
singleVariant("release") {
29+
withSourcesJar()
30+
withJavadocJar()
31+
}
32+
}
33+
compileOptions {
34+
sourceCompatibility = JavaVersion.VERSION_17
35+
targetCompatibility = JavaVersion.VERSION_17
36+
}
37+
kotlinOptions {
38+
jvmTarget = "17"
39+
}
40+
}
41+
42+
afterEvaluate {
43+
publishing {
44+
publications {
45+
create<MavenPublication>("release") {
46+
groupId = "com.shifthackz.catppuccin"
47+
artifactId = "palette-legacy"
48+
version = libs.versions.catppuccin.get()
49+
50+
from(components["release"])
51+
}
52+
}
53+
}
54+
}

palette-legacy/consumer-rules.pro

Whitespace-only changes.

palette-legacy/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest />
Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
@file:Suppress("unused")
2+
3+
package com.shifthackz.catppuccin.palette.legacy
4+
5+
import android.graphics.Color
6+
7+
/**
8+
* **Catppuccin** is a community-driven pastel theme that aims to be the middle ground between low
9+
* and high contrast themes.
10+
*
11+
* This is a legacy contract where every color is represented as [Int] and can be accessed without
12+
* android context.
13+
*
14+
* @see <a href="https://github.com/catppuccin/catppuccin">Catppuccin</a>
15+
*
16+
* @author ShiftHackZ
17+
* @since 0.1.1
18+
*/
19+
object CatppuccinLegacy {
20+
21+
/**
22+
* **Catppuccin Latte** legacy flavor color palette.
23+
*
24+
* @see <a href="https://github.com/catppuccin/catppuccin#-palette">Catppuccin Palette</a>
25+
*
26+
* @author ShiftHackZ
27+
* @since 0.1.1
28+
*/
29+
object Latte : CatppuccinLegacyPalette {
30+
override val rosewater: Int = Color.parseColor("#dc8a78")
31+
override val flamingo: Int = Color.parseColor("#dd7878")
32+
override val pink: Int = Color.parseColor("#ea76cb")
33+
override val mauve: Int = Color.parseColor("#8839ef")
34+
override val red: Int = Color.parseColor("#d20f39")
35+
override val maroon: Int = Color.parseColor("#e64553")
36+
override val peach: Int = Color.parseColor("#fe640b")
37+
override val yellow: Int = Color.parseColor("#df8e1d")
38+
override val green: Int = Color.parseColor("#40a02b")
39+
override val teal: Int = Color.parseColor("#179299")
40+
override val sky: Int = Color.parseColor("#04a5e5")
41+
override val sapphire: Int = Color.parseColor("#209fb5")
42+
override val blue: Int = Color.parseColor("#1e66f5")
43+
override val lavender: Int = Color.parseColor("#7287fd")
44+
override val text: Int = Color.parseColor("#4c4f69")
45+
override val subtext1: Int = Color.parseColor("#5c5f77")
46+
override val subtext0: Int = Color.parseColor("#6c6f85")
47+
override val overlay2: Int = Color.parseColor("#7c7f93")
48+
override val overlay1: Int = Color.parseColor("#8c8fa1")
49+
override val overlay0: Int = Color.parseColor("#9ca0b0")
50+
override val surface2: Int = Color.parseColor("#acb0be")
51+
override val surface1: Int = Color.parseColor("#bcc0cc")
52+
override val surface0: Int = Color.parseColor("#ccd0da")
53+
override val base: Int = Color.parseColor("#eff1f5")
54+
override val mantle: Int = Color.parseColor("#e6e9ef")
55+
override val crust: Int = Color.parseColor("#dce0e8")
56+
}
57+
58+
/**
59+
* **Catppuccin Frappe** legacy flavor color palette.
60+
*
61+
* @see <a href="https://github.com/catppuccin/catppuccin#-palette">Catppuccin Palette</a>
62+
*
63+
* @author ShiftHackZ
64+
* @since 0.1.1
65+
*/
66+
object Frappe : CatppuccinLegacyPalette {
67+
override val rosewater: Int = Color.parseColor("#f2d5cf")
68+
override val flamingo: Int = Color.parseColor("#eebebe")
69+
override val pink: Int = Color.parseColor("#f4b8e4")
70+
override val mauve: Int = Color.parseColor("#ca9ee6")
71+
override val red: Int = Color.parseColor("#e78284")
72+
override val maroon: Int = Color.parseColor("#ea999c")
73+
override val peach: Int = Color.parseColor("#ef9f76")
74+
override val yellow: Int = Color.parseColor("#e5c890")
75+
override val green: Int = Color.parseColor("#a6d189")
76+
override val teal: Int = Color.parseColor("#81c8be")
77+
override val sky: Int = Color.parseColor("#99d1db")
78+
override val sapphire: Int = Color.parseColor("#85c1dc")
79+
override val blue: Int = Color.parseColor("#8caaee")
80+
override val lavender: Int = Color.parseColor("#babbf1")
81+
override val text: Int = Color.parseColor("#c6d0f5")
82+
override val subtext1: Int = Color.parseColor("#b5bfe2")
83+
override val subtext0: Int = Color.parseColor("#a5adce")
84+
override val overlay2: Int = Color.parseColor("#949cbb")
85+
override val overlay1: Int = Color.parseColor("#838ba7")
86+
override val overlay0: Int = Color.parseColor("#737994")
87+
override val surface2: Int = Color.parseColor("#626880")
88+
override val surface1: Int = Color.parseColor("#51576d")
89+
override val surface0: Int = Color.parseColor("#414559")
90+
override val base: Int = Color.parseColor("#303446")
91+
override val mantle: Int = Color.parseColor("#292c3c")
92+
override val crust: Int = Color.parseColor("#232634")
93+
}
94+
95+
/**
96+
* **Catppuccin Macchiato** legacy flavor color palette.
97+
*
98+
* @see <a href="https://github.com/catppuccin/catppuccin#-palette">Catppuccin Palette</a>
99+
*
100+
* @author ShiftHackZ
101+
* @since 0.1.1
102+
*/
103+
object Macchiato : CatppuccinLegacyPalette {
104+
override val rosewater: Int = Color.parseColor("#f4dbd6")
105+
override val flamingo: Int = Color.parseColor("#f0c6c6")
106+
override val pink: Int = Color.parseColor("#f5bde6")
107+
override val mauve: Int = Color.parseColor("#c6a0f6")
108+
override val red: Int = Color.parseColor("#ed8796")
109+
override val maroon: Int = Color.parseColor("#ee99a0")
110+
override val peach: Int = Color.parseColor("#f5a97f")
111+
override val yellow: Int = Color.parseColor("#eed49f")
112+
override val green: Int = Color.parseColor("#a6da95")
113+
override val teal: Int = Color.parseColor("#8bd5ca")
114+
override val sky: Int = Color.parseColor("#91d7e3")
115+
override val sapphire: Int = Color.parseColor("#7dc4e4")
116+
override val blue: Int = Color.parseColor("#8aadf4")
117+
override val lavender: Int = Color.parseColor("#b7bdf8")
118+
override val text: Int = Color.parseColor("#cad3f5")
119+
override val subtext1: Int = Color.parseColor("#b8c0e0")
120+
override val subtext0: Int = Color.parseColor("#a5adcb")
121+
override val overlay2: Int = Color.parseColor("#939ab7")
122+
override val overlay1: Int = Color.parseColor("#8087a2")
123+
override val overlay0: Int = Color.parseColor("#6e738d")
124+
override val surface2: Int = Color.parseColor("#5b6078")
125+
override val surface1: Int = Color.parseColor("#494d64")
126+
override val surface0: Int = Color.parseColor("#363a4f")
127+
override val base: Int = Color.parseColor("#24273a")
128+
override val mantle: Int = Color.parseColor("#1e2030")
129+
override val crust: Int = Color.parseColor("#181926")
130+
}
131+
132+
/**
133+
* **Catppuccin Mocha** legacy flavor color palette.
134+
*
135+
* @see <a href="https://github.com/catppuccin/catppuccin#-palette">Catppuccin Palette</a>
136+
*
137+
* @author ShiftHackZ
138+
* @since 0.1.1
139+
*/
140+
object Mocha : CatppuccinLegacyPalette {
141+
override val rosewater: Int = Color.parseColor("#f5e0dc")
142+
override val flamingo: Int = Color.parseColor("#f2cdcd")
143+
override val pink: Int = Color.parseColor("#f5c2e7")
144+
override val mauve: Int = Color.parseColor("#cba6f7")
145+
override val red: Int = Color.parseColor("#f38ba8")
146+
override val maroon: Int = Color.parseColor("#eba0ac")
147+
override val peach: Int = Color.parseColor("#fab387")
148+
override val yellow: Int = Color.parseColor("#f9e2af")
149+
override val green: Int = Color.parseColor("#a6e3a1")
150+
override val teal: Int = Color.parseColor("#94e2d5")
151+
override val sky: Int = Color.parseColor("#89dceb")
152+
override val sapphire: Int = Color.parseColor("#74c7ec")
153+
override val blue: Int = Color.parseColor("#89b4fa")
154+
override val lavender: Int = Color.parseColor("#b4befe")
155+
override val text: Int = Color.parseColor("#cdd6f4")
156+
override val subtext1: Int = Color.parseColor("#bac2de")
157+
override val subtext0: Int = Color.parseColor("#a6adc8")
158+
override val overlay2: Int = Color.parseColor("#9399b2")
159+
override val overlay1: Int = Color.parseColor("#7f849c")
160+
override val overlay0: Int = Color.parseColor("#6c7086")
161+
override val surface2: Int = Color.parseColor("#585b70")
162+
override val surface1: Int = Color.parseColor("#45475a")
163+
override val surface0: Int = Color.parseColor("#313244")
164+
override val base: Int = Color.parseColor("#1e1e2e")
165+
override val mantle: Int = Color.parseColor("#181825")
166+
override val crust: Int = Color.parseColor("#11111b")
167+
}
168+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package com.shifthackz.catppuccin.palette.legacy
2+
3+
/**
4+
* Interface contract that determines all available **Catppuccin** legacy color labels.
5+
*
6+
* This is a legacy contract where every color is represented as [Int].
7+
*
8+
* @see <a href="https://github.com/catppuccin/catppuccin#-palette">Catppuccin Palette</a>
9+
*
10+
* @author ShiftHackZ
11+
* @since 0.1.1
12+
*/
13+
interface CatppuccinLegacyPalette {
14+
val rosewater: Int
15+
val flamingo: Int
16+
val pink: Int
17+
val mauve: Int
18+
val red: Int
19+
val maroon: Int
20+
val peach: Int
21+
val yellow: Int
22+
val green: Int
23+
val teal: Int
24+
val sky: Int
25+
val sapphire: Int
26+
val blue: Int
27+
val lavender: Int
28+
val text: Int
29+
val subtext1: Int
30+
val subtext0: Int
31+
val overlay2: Int
32+
val overlay1: Int
33+
val overlay0: Int
34+
val surface2: Int
35+
val surface1: Int
36+
val surface0: Int
37+
val base: Int
38+
val mantle: Int
39+
val crust: Int
40+
}

0 commit comments

Comments
 (0)