Record Class ThemePalette
java.lang.Object
java.lang.Record
dev.myriadclient.api.ui.ThemePalette
- Record Components:
background- the window background's base colourforeground- text colourselection- selection colour, the base of surfaces and the inactive borderaccent- the accent colouransi- the 16 ANSI colours, indexed as terminals do (1 red, 2 green, 3 yellow, 4 blue, 5 magenta, 6 cyan); must hold at least 7borderFrom- the active border's first gradient stop, or null to follow the accentborderTo- the active border's second stop, or null to follow the secondary colour; it is also the secondary colour unless it's null or the accent's own, when magenta (ansi[5]) isinactiveBorder- the inactive border, or null for a translucent selection colourrounding- window rounding in Hyprland's pixels (halved into UI units), or null to leave it as it is
public record ThemePalette(int background, int foreground, int selection, int accent, int[] ansi, @Nullable Integer borderFrom, @Nullable Integer borderTo, @Nullable Integer inactiveBorder, @Nullable Integer rounding)
extends Record
A terminal-style colour scheme (background, foreground, selection, accent and the 16 ANSI colours) and the mapping
from it to every colour a Myriad theme has. Build themes from editor or terminal schemes without picking 20 colours
by hand. Border and rounding values are optional. Colours are ARGB ints.
-
Constructor Summary
ConstructorsConstructorDescriptionThemePalette(int background, int foreground, int selection, int accent, int[] ansi, @Nullable Integer borderFrom, @Nullable Integer borderTo, @Nullable Integer inactiveBorder, @Nullable Integer rounding) Creates an instance of aThemePaletterecord class. -
Method Summary
Modifier and TypeMethodDescriptionintaccent()Returns the value of theaccentrecord component.int[]ansi()Returns the value of theansirecord component.intansi(int i) ANSI colouri(0-15).voidWrites the palette into a theme: the accent, secondary, borders, text, backgrounds, surfaces, menu tint, bar and the six palette colours, each derived from the scheme (backgrounds translucent, dim text between the foreground and background).intReturns the value of thebackgroundrecord component.@Nullable IntegerReturns the value of theborderFromrecord component.@Nullable IntegerborderTo()Returns the value of theborderTorecord component.final booleanIndicates whether some other object is "equal to" this one.intReturns the value of theforegroundrecord component.final inthashCode()Returns a hash code value for this object.@Nullable IntegerReturns the value of theinactiveBorderrecord component.static ThemePaletteof(int background, int foreground, int selection, int accent, int secondary, int red, int green, int yellow, int blue, int magenta, int cyan) A palette from the colours a theme preset usually names; the other ANSI slots use the foreground.@Nullable Integerrounding()Returns the value of theroundingrecord component.intReturns the value of theselectionrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ThemePalette
public ThemePalette(int background, int foreground, int selection, int accent, int[] ansi, @Nullable Integer borderFrom, @Nullable Integer borderTo, @Nullable Integer inactiveBorder, @Nullable Integer rounding) Creates an instance of aThemePaletterecord class.- Parameters:
background- the value for thebackgroundrecord componentforeground- the value for theforegroundrecord componentselection- the value for theselectionrecord componentaccent- the value for theaccentrecord componentansi- the value for theansirecord componentborderFrom- the value for theborderFromrecord componentborderTo- the value for theborderTorecord componentinactiveBorder- the value for theinactiveBorderrecord componentrounding- the value for theroundingrecord component
-
-
Method Details
-
ansi
public int ansi(int i) ANSI colouri(0-15). -
of
public static ThemePalette of(int background, int foreground, int selection, int accent, int secondary, int red, int green, int yellow, int blue, int magenta, int cyan) A palette from the colours a theme preset usually names; the other ANSI slots use the foreground.secondarybecomes the active border's second stop and, unless it matches the accent, the theme's secondary colour. -
apply
Writes the palette into a theme: the accent, secondary, borders, text, backgrounds, surfaces, menu tint, bar and the six palette colours, each derived from the scheme (backgrounds translucent, dim text between the foreground and background). Only colours (and rounding, if set) change. Call it from aTheme's apply function. -
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
background
public int background()Returns the value of thebackgroundrecord component.- Returns:
- the value of the
backgroundrecord component
-
foreground
public int foreground()Returns the value of theforegroundrecord component.- Returns:
- the value of the
foregroundrecord component
-
selection
-
accent
-
ansi
-
borderFrom
Returns the value of theborderFromrecord component.- Returns:
- the value of the
borderFromrecord component
-
borderTo
-
inactiveBorder
Returns the value of theinactiveBorderrecord component.- Returns:
- the value of the
inactiveBorderrecord component
-
rounding
-