module

Palette

Static 32-color Afterlife 98 palette registry backed by palette.pal and palette.tres.

Provides O(1) indexed, enum, and named access to all 32 palette colors as Godot::Color, plus helpers to apply foreground, background, outline, and unreplaced colors to ShaderMaterial.

Constants

NAMES = ["deep_indigo", "dusk_purple", "muted_violet", "soft_periwinkle", "pale_lilac", "white", "honeydew_mint", "seafoam", "teal", "deep_cerulean", "cyan_lagoon", "ice_aqua", "sage_gray", "dry_moss", "warm_cream", "peach_sorbet", "apricot_coral", "salmon_pink", "hot_watermelon", "plum_rose", "dusty_mauve", "rose_quartz", "pale_blush", "cornflower_blue", "sky_azure", "baby_blue", "lavender_mist", "orchid_violet", "amethyst", "bubblegum_pink", "cotton_candy", "snow_rose"]
PAL_PATH = "res://palette.pal"
RGB8_TABLE = [{47_u8, 37_u8, 86_u8}, {88_u8, 76_u8, 132_u8}, {130_u8, 124_u8, 175_u8}, {174_u8, 171_u8, 211_u8}, {206_u8, 207_u8, 240_u8}, {255_u8, 255_u8, 255_u8}, {201_u8, 255_u8, 191_u8}, {120_u8, 216_u8, 183_u8}, {52_u8, 173_u8, 161_u8}, {37_u8, 125_u8, 155_u8}, {37_u8, 188_u8, 198_u8}, {160_u8, 255_u8, 240_u8}, {132_u8, 165_u8, 148_u8}, {207_u8, 211_u8, 175_u8}, {255_u8, 242_u8, 209_u8}, {255_u8, 217_u8, 174_u8}, {255_u8, 165_u8, 130_u8}, {255_u8, 128_u8, 126_u8}, {255_u8, 84_u8, 112_u8}, {152_u8, 88_u8, 104_u8}, {183_u8, 132_u8, 130_u8}, {221_u8, 164_u8, 159_u8}, {224_u8, 189_u8, 193_u8}, {119_u8, 137_u8, 239_u8}, {94_u8, 193_u8, 255_u8}, {186_u8, 230_u8, 255_u8}, {226_u8, 211_u8, 255_u8}, {190_u8, 155_u8, 255_u8}, {153_u8, 104_u8, 226_u8}, {255_u8, 155_u8, 182_u8}, {255_u8, 204_u8, 220_u8}, {255_u8, 234_u8, 246_u8}]

Raw 8-bit RGB triplets from palette.pal (32 colors, indices 0..31).

THEMES = {Theme::WatermelonPunch => ThemeColors.new(fg: ColorId::HotWatermelon, bg: ColorId::IceAqua, outline: ColorId::White, unreplaced: ColorId::DeepIndigo, mid: ColorId::PeachSorbet), Theme::CyberMint => ThemeColors.new(fg: ColorId::HoneydewMint, bg: ColorId::DeepIndigo, outline: ColorId::IceAqua, unreplaced: ColorId::CyanLagoon, mid: ColorId::Teal), Theme::MidnightAmethyst => ThemeColors.new(fg: ColorId::OrchidViolet, bg: ColorId::DeepIndigo, outline: ColorId::LavenderMist, unreplaced: ColorId::Amethyst, mid: ColorId::MutedViolet), Theme::VaporwaveSunset => ThemeColors.new(fg: ColorId::PeachSorbet, bg: ColorId::DuskPurple, outline: ColorId::WarmCream, unreplaced: ColorId::HotWatermelon, mid: ColorId::SalmonPink), Theme::ArcticLagoon => ThemeColors.new(fg: ColorId::IceAqua, bg: ColorId::DeepCerulean, outline: ColorId::White, unreplaced: ColorId::DeepIndigo, mid: ColorId::CyanLagoon), Theme::PeachCream => ThemeColors.new(fg: ColorId::WarmCream, bg: ColorId::PlumRose, outline: ColorId::White, unreplaced: ColorId::DeepIndigo, mid: ColorId::ApricotCoral), Theme::NeonPlum => ThemeColors.new(fg: ColorId::BubblegumPink, bg: ColorId::DuskPurple, outline: ColorId::SnowRose, unreplaced: ColorId::DeepIndigo, mid: ColorId::OrchidViolet), Theme::MossyStone => ThemeColors.new(fg: ColorId::DryMoss, bg: ColorId::DeepIndigo, outline: ColorId::WarmCream, unreplaced: ColorId::SageGray, mid: ColorId::SageGray), Theme::CoralReef => ThemeColors.new(fg: ColorId::ApricotCoral, bg: ColorId::Teal, outline: ColorId::WarmCream, unreplaced: ColorId::DeepIndigo, mid: ColorId::Seafoam), Theme::BubblegumPop => ThemeColors.new(fg: ColorId::CottonCandy, bg: ColorId::CornflowerBlue, outline: ColorId::White, unreplaced: ColorId::DeepIndigo, mid: ColorId::SkyAzure), Theme::DeepOcean => ThemeColors.new(fg: ColorId::SkyAzure, bg: ColorId::DeepIndigo, outline: ColorId::BabyBlue, unreplaced: ColorId::DeepCerulean, mid: ColorId::CornflowerBlue), Theme::HighContrastMono => ThemeColors.new(fg: ColorId::White, bg: ColorId::DeepIndigo, outline: ColorId::White, unreplaced: ColorId::DuskPurple, mid: ColorId::SoftPeriwinkle)}
TRES_PATH = "res://palette.tres"

Class methods

[](index : Int) : Color
Source
[](id : ColorId) : Color
Source
[](name : String | Symbol) : Color
Source
[]?(index : Int) : Color | Nil
Source
[]?(id : ColorId) : Color | Nil
Source
[]?(name : String | Symbol) : Color | Nil
Source
apply_theme(material : ShaderMaterial, theme_key : Theme | String | Symbol, use_tritone : Bool = false) : ThemeColors

Applies a curated Palette::Theme onto a ShaderMaterial (including fg_color, bg_color, outline_color, unreplaced_color, and optionally mid_color tritone ramp).

Source
apply_to(material : ShaderMaterial, fg : ColorId | Int | String | Symbol | Color, bg : ColorId | Int | String | Symbol | Color, outline : ColorId | Int | String | Symbol | Color | Nil = nil, unreplaced : ColorId | Int | String | Symbol | Color | Nil = nil) : Void

Applies palette colors (fg_color, bg_color, and optionally outline_color and unreplaced_color) onto a ShaderMaterial using pattern_replace.gdshader.

Source
at(index : Int) : Color

Returns the Godot::Color at 0-based index (0..31), raising IndexError if out of bounds.

Source
at?(index : Int) : Color | Nil
Source
colors

Returns all 32 Godot::Color entries in palette order.

Source
contrast_for(col : ColorId | Int | String | Symbol | Color) : Color

Returns a high-contrast Afterlife 98 palette color (White for dark inputs, DeepIndigo for light inputs).

Source
count
Source
index(name : String | Symbol) : Int32
Source
index?(name : String | Symbol) : Int32 | Nil

Looks up a palette index (0..31) by semantic color name.

Source
luminance(col : ColorId | Int | String | Symbol | Color) : Float64

Computes relative perceptual luminance in [0.0, 1.0] for any palette entry or Color.

Source
names
Source
nearest(target : Color) : Color

Returns the closest Godot::Color in the 32-color palette to target.

Source
nearest_id(target : Color) : ColorId

Finds the closest ColorId in the 32-color Afterlife 98 palette to an arbitrary Godot::Color using weighted perceptual RGB Euclidean distance.

Source
resolve(col : ColorId | Int | String | Symbol | Color) : Color

Resolves a ColorId, Int, String, Symbol, or Color into a Godot::Color.

Source
size
Source
theme(key : Theme | String | Symbol) : ThemeColors
Source
theme?(key : Theme | String | Symbol) : ThemeColors | Nil

Resolves a Palette::Theme by enum, String, or Symbol (e.g. :watermelon_punch or "CyberMint").

Source

Nested types