-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
186342b
commit c0d7cf6
Showing
23 changed files
with
2,227 additions
and
1,071 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.catppuccin; | ||
|
||
public class Color { | ||
private int r; | ||
private int g; | ||
private int b; | ||
|
||
public Color(int r, int b, int g) { | ||
this.r = r; | ||
this.g = g; | ||
this.b = b; | ||
} | ||
|
||
public int r() { | ||
return this.r; | ||
} | ||
|
||
public int g() { | ||
return this.g; | ||
} | ||
|
||
public int b() { | ||
return this.b; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Color { r=%d, g=%d, b=%d }".formatted(r, g, b); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
if (this == obj) { | ||
return true; | ||
} | ||
|
||
if (!(obj instanceof Color)) { | ||
return false; | ||
} | ||
|
||
Color other = (Color) obj; | ||
return this.r == other.r && this.g == other.g && this.b == other.b; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.catppuccin; | ||
|
||
public interface Flavor { | ||
String name(); | ||
|
||
Color rosewater(); | ||
Color flamingo(); | ||
Color pink(); | ||
Color mauve(); | ||
Color red(); | ||
Color maroon(); | ||
Color peach(); | ||
Color yellow(); | ||
Color green(); | ||
Color teal(); | ||
Color sky(); | ||
Color sapphire(); | ||
Color blue(); | ||
Color lavender(); | ||
Color text(); | ||
Color subtext1(); | ||
Color subtext0(); | ||
Color overlay2(); | ||
Color overlay1(); | ||
Color overlay0(); | ||
Color surface2(); | ||
Color surface1(); | ||
Color surface0(); | ||
Color base(); | ||
Color mantle(); | ||
Color crust(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.catppuccin; | ||
|
||
@GeneratedPalette(target="com.catppuccin.BuiltinPalettes") | ||
public class Palette | ||
{ | ||
public static final Flavor MOCHA = com.catppuccin.BuiltinPalettes.MOCHA; | ||
public static final Flavor MACCHIATO = com.catppuccin.BuiltinPalettes.MACCHIATO; | ||
public static final Flavor FRAPPE = com.catppuccin.BuiltinPalettes.FRAPPE; | ||
public static final Flavor LATTE = com.catppuccin.BuiltinPalettes.LATTE; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package com.catppuccin; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotEquals; | ||
import org.junit.Test; | ||
|
||
class Oled extends BuiltinPalettes.Mocha { | ||
@Override | ||
public Color base() { | ||
return new Color(0, 0, 0); | ||
} | ||
} | ||
|
||
public class PaletteTests { | ||
@Test | ||
public void mochaExistsAndReturnsCorrectDetails() { | ||
assertEquals("mocha to have the correct name", "mocha", Palette.MOCHA.name()); | ||
} | ||
|
||
@Test | ||
public void builtinMochaExistsAndReturnsCorrectDetails() { | ||
BuiltinPalettes.Mocha palette = BuiltinPalettes.MOCHA; | ||
assertEquals("mocha to have the correct name", "mocha", palette.name()); | ||
} | ||
|
||
@Test | ||
public void frappeExistsAndReturnsCorrectDetails() { | ||
assertEquals("frappe to have the correct name", "frappe", Palette.FRAPPE.name()); | ||
} | ||
|
||
@Test | ||
public void builtinFrappeExistsAndReturnsCorrectDetails() { | ||
BuiltinPalettes.Frappe palette = BuiltinPalettes.FRAPPE; | ||
assertEquals("frappe to have the correct name", "frappe", palette.name()); | ||
} | ||
|
||
@Test | ||
public void macchiatoExistsAndReturnsCorrectDetails() { | ||
assertEquals("macchiato to have the correct name", "macchiato", Palette.MACCHIATO.name()); | ||
} | ||
|
||
@Test | ||
public void builtinMacchiatoExistsAndReturnsCorrectDetails() { | ||
BuiltinPalettes.Macchiato palette = BuiltinPalettes.MACCHIATO; | ||
assertEquals("macchiato to have the correct name", "macchiato", palette.name()); | ||
} | ||
|
||
@Test | ||
public void latteExistsAndReturnsCorrectDetails() { | ||
assertEquals("latte to have the correct name", "latte", Palette.LATTE.name()); | ||
} | ||
|
||
@Test | ||
public void builtinLatteExistsAndReturnsCorrectDetails() { | ||
BuiltinPalettes.Latte palette = BuiltinPalettes.LATTE; | ||
assertEquals("latte to have the correct name", "latte", palette.name()); | ||
} | ||
|
||
@Test | ||
public void oledOverridesProperly() { | ||
Flavor mocha = Palette.MOCHA; | ||
Flavor oled = new Oled(); | ||
|
||
assertEquals("oled red and mocha red to be the same", mocha.red(), oled.red()); | ||
assertEquals("oled base is 0, 0, 0", new Color(0, 0, 0), oled.base()); | ||
assertNotEquals("oled base and mocha base to not be the same", mocha.base(), oled.base()); | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,197 @@ | ||
package com.catppuccin; | ||
|
||
import java.util.Map; | ||
|
||
public class POJO { | ||
public static class Root { | ||
public Flavor latte; | ||
public Flavor frappe; | ||
public Flavor macchiato; | ||
public Flavor mocha; | ||
|
||
@Override | ||
public String toString() { | ||
return "Root { latte=%s, frappe=%s, macchiato=%s, mocha=%s}".formatted(latte, frappe, macchiato, mocha); | ||
} | ||
} | ||
|
||
public class Flavor { | ||
private String name; | ||
private long order; | ||
private boolean dark; | ||
private Map<String, Color> colors; | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String value) { | ||
this.name = value; | ||
} | ||
|
||
public long getOrder() { | ||
return order; | ||
} | ||
|
||
public void setOrder(long value) { | ||
this.order = value; | ||
} | ||
|
||
public boolean isDark() { | ||
return dark; | ||
} | ||
|
||
public boolean isLight() { | ||
return !isDark(); | ||
} | ||
|
||
public void setDark(boolean value) { | ||
this.dark = value; | ||
} | ||
|
||
public Map<String, Color> getColors() { | ||
return colors; | ||
} | ||
|
||
public void setColors(Map<String, Color> value) { | ||
this.colors = value; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Flavor { name=%s, order=%d, dark=%b, colors=%s }".formatted(name, order, dark, colors); | ||
} | ||
} | ||
|
||
public class Color { | ||
private String name; | ||
private long order; | ||
private String hex; | ||
private RGB rgb; | ||
private Hsl hsl; | ||
private boolean accent; | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String value) { | ||
this.name = value; | ||
} | ||
|
||
public long getOrder() { | ||
return order; | ||
} | ||
|
||
public void setOrder(long value) { | ||
this.order = value; | ||
} | ||
|
||
public String getHex() { | ||
return hex; | ||
} | ||
|
||
public void setHex(String value) { | ||
this.hex = value; | ||
} | ||
|
||
public RGB getRGB() { | ||
return rgb; | ||
} | ||
|
||
public void setRGB(RGB value) { | ||
this.rgb = value; | ||
} | ||
|
||
public Hsl getHsl() { | ||
return hsl; | ||
} | ||
|
||
public void setHsl(Hsl value) { | ||
this.hsl = value; | ||
} | ||
|
||
public boolean getAccent() { | ||
return accent; | ||
} | ||
|
||
public void setAccent(boolean value) { | ||
this.accent = value; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Color { name=%s, order=%d, hex=%s, rgb=%s, hsl=%s, accent=%b }".formatted(name, order, hex, rgb, hsl, accent); | ||
} | ||
} | ||
|
||
public class Hsl { | ||
private double h; | ||
private double s; | ||
private double l; | ||
|
||
public double getH() { | ||
return h; | ||
} | ||
|
||
public void setH(double value) { | ||
this.h = value; | ||
} | ||
|
||
public double getS() { | ||
return s; | ||
} | ||
|
||
public void setS(double value) { | ||
this.s = value; | ||
} | ||
|
||
public double getL() { | ||
return l; | ||
} | ||
|
||
public void setL(double value) { | ||
this.l = value; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "HSL { %f %f %f }".formatted(h, s, l); | ||
} | ||
} | ||
|
||
public class RGB { | ||
private int r; | ||
private int g; | ||
private int b; | ||
|
||
public int getR() { | ||
return r; | ||
} | ||
|
||
public void setR(int value) { | ||
this.r = value; | ||
} | ||
|
||
public int getG() { | ||
return g; | ||
} | ||
|
||
public void setG(int value) { | ||
this.g = value; | ||
} | ||
|
||
public int getB() { | ||
return b; | ||
} | ||
|
||
public void setB(int value) { | ||
this.b = value; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "RGB { %d %d %d }".formatted(r, g, b); | ||
} | ||
} | ||
} |
Oops, something went wrong.