Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 54 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,38 @@ Then add all or only needed library module dependencies to your module level bui
```
dependencies {
implementation 'com.github.ShiftHackZ.Catppuccin-Android-Library:palette:<VERSION>'
implementation 'com.github.ShiftHackZ.Catppuccin-Android-Library:palette-legacy:<VERSION>'
implementation 'com.github.ShiftHackZ.Catppuccin-Android-Library:compose:<VERSION>'
implementation 'com.github.ShiftHackZ.Catppuccin-Android-Library:splashscreen:<VERSION>'
}
```

### Palette

Implements Catppuccin color palette: Catppuccin.Latte, Catppuccin.Frappe, Catppuccin.Macchiato, Catppuccin.Mocha.
Implements Catppuccin color compose palette:
- Catppuccin.Latte
- Catppuccin.Frappe
- Catppuccin.Macchiato
- Catppuccin.Mocha

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

### Palette Legacy

**Available since version 0.1.1**

Implements Catppuccin color palette as xml resources and static colors that can be accessed without context:
- CatppuccinLegacy.Latte
- CatppuccinLegacy.Frappe
- CatppuccinLegacy.Macchiato
- CatppuccinLegacy.Mocha

```
implementation 'com.github.ShiftHackZ.Catppuccin-Android-Library:palette-legacy:<VERSION>'
```

### Compose

Implements Android Jetpack Compose Catppuccin material themes.
Expand Down Expand Up @@ -95,6 +114,40 @@ fun RedText(text: String) {
}
```

### Palette Legacy

To access a color in XML or programatically with context, use `catppuccin_<flavor>_<color>`:

```xml
<View
android:color="@color/catppuccin_frappe_sub_text_1"
/>
```

```xml
<View
android:color="@color/catppuccin_frappe_red"
/>
```

Or you can access it with context like this:

```kotlin
import com.shifthackz.catppuccin.palette.legacy.R as CatppuccinRes

...
val color = ContextCompat.getColor(context, CatppuccinRes.catppuccin_frappe_red)
...

```

In case you need a color represented as Int value (or simply don't want to use context)
you can access the color by call `CatppuccinLegacy.<Flavor>.<color>`:

```kotlin
val color = CatppuccinLegacy.Frappe.red
```

### Compose material themes

#### Themes overview
Expand Down
2 changes: 2 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ android {
}

dependencies {
implementation(project(":palette"))
implementation(project(":palette-legacy"))
implementation(project(":compose"))
implementation(project(":splashscreen"))

Expand Down
3 changes: 1 addition & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
catppuccin = "0.1.0"
catppuccin = "0.1.1"
activityCompose = "1.8.2"
androidGradlePlugin = "8.2.0"
kotlin = "1.9.10"
Expand All @@ -12,7 +12,6 @@ lifecycleRuntimeKtx = "2.6.2"
lifecycleCompose = "2.6.2"
material3 = "1.1.2"


[libraries]
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "activityCompose" }
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidxCoreKtx" }
Expand Down
1 change: 1 addition & 0 deletions palette-legacy/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
54 changes: 54 additions & 0 deletions palette-legacy/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.org.jetbrains.kotlin.android)
`maven-publish`
}

android {
namespace = "com.shifthackz.catppuccin.palette.legacy"
compileSdk = 34

defaultConfig {
minSdk = 21

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
publishing {
singleVariant("release") {
withSourcesJar()
withJavadocJar()
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
}

afterEvaluate {
publishing {
publications {
create<MavenPublication>("release") {
groupId = "com.shifthackz.catppuccin"
artifactId = "palette-legacy"
version = libs.versions.catppuccin.get()

from(components["release"])
}
}
}
}
Empty file.
21 changes: 21 additions & 0 deletions palette-legacy/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
2 changes: 2 additions & 0 deletions palette-legacy/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
@file:Suppress("unused")

package com.shifthackz.catppuccin.palette.legacy

import android.graphics.Color

/**
* **Catppuccin** is a community-driven pastel theme that aims to be the middle ground between low
* and high contrast themes.
*
* This is a legacy contract where every color is represented as [Int] and can be accessed without
* android context.
*
* @see <a href="https://github.com/catppuccin/catppuccin">Catppuccin</a>
*
* @author ShiftHackZ
* @since 0.1.1
*/
object CatppuccinLegacy {

/**
* **Catppuccin Latte** legacy flavor color palette.
*
* @see <a href="https://github.com/catppuccin/catppuccin#-palette">Catppuccin Palette</a>
*
* @author ShiftHackZ
* @since 0.1.1
*/
object Latte : CatppuccinLegacyPalette {
override val rosewater: Int = Color.parseColor("#dc8a78")
override val flamingo: Int = Color.parseColor("#dd7878")
override val pink: Int = Color.parseColor("#ea76cb")
override val mauve: Int = Color.parseColor("#8839ef")
override val red: Int = Color.parseColor("#d20f39")
override val maroon: Int = Color.parseColor("#e64553")
override val peach: Int = Color.parseColor("#fe640b")
override val yellow: Int = Color.parseColor("#df8e1d")
override val green: Int = Color.parseColor("#40a02b")
override val teal: Int = Color.parseColor("#179299")
override val sky: Int = Color.parseColor("#04a5e5")
override val sapphire: Int = Color.parseColor("#209fb5")
override val blue: Int = Color.parseColor("#1e66f5")
override val lavender: Int = Color.parseColor("#7287fd")
override val text: Int = Color.parseColor("#4c4f69")
override val subtext1: Int = Color.parseColor("#5c5f77")
override val subtext0: Int = Color.parseColor("#6c6f85")
override val overlay2: Int = Color.parseColor("#7c7f93")
override val overlay1: Int = Color.parseColor("#8c8fa1")
override val overlay0: Int = Color.parseColor("#9ca0b0")
override val surface2: Int = Color.parseColor("#acb0be")
override val surface1: Int = Color.parseColor("#bcc0cc")
override val surface0: Int = Color.parseColor("#ccd0da")
override val base: Int = Color.parseColor("#eff1f5")
override val mantle: Int = Color.parseColor("#e6e9ef")
override val crust: Int = Color.parseColor("#dce0e8")
}

/**
* **Catppuccin Frappe** legacy flavor color palette.
*
* @see <a href="https://github.com/catppuccin/catppuccin#-palette">Catppuccin Palette</a>
*
* @author ShiftHackZ
* @since 0.1.1
*/
object Frappe : CatppuccinLegacyPalette {
override val rosewater: Int = Color.parseColor("#f2d5cf")
override val flamingo: Int = Color.parseColor("#eebebe")
override val pink: Int = Color.parseColor("#f4b8e4")
override val mauve: Int = Color.parseColor("#ca9ee6")
override val red: Int = Color.parseColor("#e78284")
override val maroon: Int = Color.parseColor("#ea999c")
override val peach: Int = Color.parseColor("#ef9f76")
override val yellow: Int = Color.parseColor("#e5c890")
override val green: Int = Color.parseColor("#a6d189")
override val teal: Int = Color.parseColor("#81c8be")
override val sky: Int = Color.parseColor("#99d1db")
override val sapphire: Int = Color.parseColor("#85c1dc")
override val blue: Int = Color.parseColor("#8caaee")
override val lavender: Int = Color.parseColor("#babbf1")
override val text: Int = Color.parseColor("#c6d0f5")
override val subtext1: Int = Color.parseColor("#b5bfe2")
override val subtext0: Int = Color.parseColor("#a5adce")
override val overlay2: Int = Color.parseColor("#949cbb")
override val overlay1: Int = Color.parseColor("#838ba7")
override val overlay0: Int = Color.parseColor("#737994")
override val surface2: Int = Color.parseColor("#626880")
override val surface1: Int = Color.parseColor("#51576d")
override val surface0: Int = Color.parseColor("#414559")
override val base: Int = Color.parseColor("#303446")
override val mantle: Int = Color.parseColor("#292c3c")
override val crust: Int = Color.parseColor("#232634")
}

/**
* **Catppuccin Macchiato** legacy flavor color palette.
*
* @see <a href="https://github.com/catppuccin/catppuccin#-palette">Catppuccin Palette</a>
*
* @author ShiftHackZ
* @since 0.1.1
*/
object Macchiato : CatppuccinLegacyPalette {
override val rosewater: Int = Color.parseColor("#f4dbd6")
override val flamingo: Int = Color.parseColor("#f0c6c6")
override val pink: Int = Color.parseColor("#f5bde6")
override val mauve: Int = Color.parseColor("#c6a0f6")
override val red: Int = Color.parseColor("#ed8796")
override val maroon: Int = Color.parseColor("#ee99a0")
override val peach: Int = Color.parseColor("#f5a97f")
override val yellow: Int = Color.parseColor("#eed49f")
override val green: Int = Color.parseColor("#a6da95")
override val teal: Int = Color.parseColor("#8bd5ca")
override val sky: Int = Color.parseColor("#91d7e3")
override val sapphire: Int = Color.parseColor("#7dc4e4")
override val blue: Int = Color.parseColor("#8aadf4")
override val lavender: Int = Color.parseColor("#b7bdf8")
override val text: Int = Color.parseColor("#cad3f5")
override val subtext1: Int = Color.parseColor("#b8c0e0")
override val subtext0: Int = Color.parseColor("#a5adcb")
override val overlay2: Int = Color.parseColor("#939ab7")
override val overlay1: Int = Color.parseColor("#8087a2")
override val overlay0: Int = Color.parseColor("#6e738d")
override val surface2: Int = Color.parseColor("#5b6078")
override val surface1: Int = Color.parseColor("#494d64")
override val surface0: Int = Color.parseColor("#363a4f")
override val base: Int = Color.parseColor("#24273a")
override val mantle: Int = Color.parseColor("#1e2030")
override val crust: Int = Color.parseColor("#181926")
}

/**
* **Catppuccin Mocha** legacy flavor color palette.
*
* @see <a href="https://github.com/catppuccin/catppuccin#-palette">Catppuccin Palette</a>
*
* @author ShiftHackZ
* @since 0.1.1
*/
object Mocha : CatppuccinLegacyPalette {
override val rosewater: Int = Color.parseColor("#f5e0dc")
override val flamingo: Int = Color.parseColor("#f2cdcd")
override val pink: Int = Color.parseColor("#f5c2e7")
override val mauve: Int = Color.parseColor("#cba6f7")
override val red: Int = Color.parseColor("#f38ba8")
override val maroon: Int = Color.parseColor("#eba0ac")
override val peach: Int = Color.parseColor("#fab387")
override val yellow: Int = Color.parseColor("#f9e2af")
override val green: Int = Color.parseColor("#a6e3a1")
override val teal: Int = Color.parseColor("#94e2d5")
override val sky: Int = Color.parseColor("#89dceb")
override val sapphire: Int = Color.parseColor("#74c7ec")
override val blue: Int = Color.parseColor("#89b4fa")
override val lavender: Int = Color.parseColor("#b4befe")
override val text: Int = Color.parseColor("#cdd6f4")
override val subtext1: Int = Color.parseColor("#bac2de")
override val subtext0: Int = Color.parseColor("#a6adc8")
override val overlay2: Int = Color.parseColor("#9399b2")
override val overlay1: Int = Color.parseColor("#7f849c")
override val overlay0: Int = Color.parseColor("#6c7086")
override val surface2: Int = Color.parseColor("#585b70")
override val surface1: Int = Color.parseColor("#45475a")
override val surface0: Int = Color.parseColor("#313244")
override val base: Int = Color.parseColor("#1e1e2e")
override val mantle: Int = Color.parseColor("#181825")
override val crust: Int = Color.parseColor("#11111b")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.shifthackz.catppuccin.palette.legacy

/**
* Interface contract that determines all available **Catppuccin** legacy color labels.
*
* This is a legacy contract where every color is represented as [Int].
*
* @see <a href="https://github.com/catppuccin/catppuccin#-palette">Catppuccin Palette</a>
*
* @author ShiftHackZ
* @since 0.1.1
*/
interface CatppuccinLegacyPalette {
val rosewater: Int
val flamingo: Int
val pink: Int
val mauve: Int
val red: Int
val maroon: Int
val peach: Int
val yellow: Int
val green: Int
val teal: Int
val sky: Int
val sapphire: Int
val blue: Int
val lavender: Int
val text: Int
val subtext1: Int
val subtext0: Int
val overlay2: Int
val overlay1: Int
val overlay0: Int
val surface2: Int
val surface1: Int
val surface0: Int
val base: Int
val mantle: Int
val crust: Int
}
Loading