mirror of
https://github.com/catppuccin/java.git
synced 2026-02-05 04:27:27 +08:00
This commit rewrites the library to be generated from the palette.json which acts as a source of truth. The project is now a multi-module maven project, with the "processing" module responsible for generating the code used in the "palette" module. Both modules will be published to Maven Central and available as separate JARs. Co-authored-by: sgoudham <sgoudham@gmail.com>
3.6 KiB
3.6 KiB

Catppuccin for Java
Installation
Be sure to replace the VERSION key below with the version shown above!
Maven
<!-- https://mvnrepository.com/artifact/com.catppuccin/catppuccin-palette -->
<dependency>
<groupId>com.catppuccin</groupId>
<artifactId>catppuccin-palette</artifactId>
<version>VERSION</version>
</dependency>
Gradle
repositories {
mavenCentral()
}
dependencies {
// https://mvnrepository.com/artifact/com.catppuccin/catppuccin-palette
implementation group: 'com.catppuccin', name: 'catppuccin-palette', version: 'VERSION'
}
Binaries
If you choose not to use a build tool, pre-built .jar files are available with every
single release.
Usage
package com.catppuccin;
public class Main {
public static void main(String[] args) {
String mocha = Palette.MOCHA.name(); // mocha
String mochaBaseHex = Palette.MOCHA.base().hex(); // 1e1e2e
int[] mochaBaseRGB = Palette.MOCHA.base().components(); // [30, 30, 46]
// loop through just frappé
for (Pair<String, Color> colourPair : Palette.FRAPPE.toList()) {
String name = colourPair.key();
Color colour = colourPair.value();
System.out.println(name + ": " + colour.hex());
}
// loop through every colour
for (Flavour flavour : Palette.toList()) {
System.out.println("Flavour: " + flavour.name());
for (Pair<String, Color> colourPair : flavour.toList()) {
String name = colourPair.key();
Color colour = colourPair.value();
System.out.println(name + ": " + colour.hex());
}
}
}
}
Contributing
If you are looking to contribute, please read through our CONTRIBUTING.md first!
💝 Thanks to
Copyright © 2023-present Catppuccin Org