Colors
Kore provides a unified Color API that covers three families of colors used by Minecraft:
FormattingColorandBossBarColor(named colors for chat, UI, teams, etc.)RGBandARGB(numeric colors)DyeColors(the 16 dye colors used by entities and items)
For the vanilla reference on color behavior, see the Minecraft Wiki - Color.
Color types in Kore
Color(sealed interface): umbrella type accepted by most helpers.FormattingColor: named chat/formatting colors (e.g.Color.RED,Color.AQUA).BossBarColor: bossbar's named colors.RGB/ARGB: numeric colors.RGBis#rrggbb,ARGBis#aarrggbb.DyeColors: 16 dye colors (white, orange, magenta, …, black) for collars, shulkers, sheep, tropical fish, etc.
Every named chat color as the game draws it, click one to copy its Kotlin name.
In game: the 16 chat colors. Color.PINK and Color.PURPLE are boss bar colors, so they aren't in this list.
Helpers to create numeric colors:
Conversions and utils:
Random colors
Kore provides static random() helpers on the color classes to simplify testing and procedural generation. You can also use a Random instance to generate random colors with a specific seed.
These helpers are available on:
RGB:RGB.random(random: Random = Random): returns a random RGBARGB:ARGB.random(random: Random = Random, alpha: Boolean = false): returns a random ARGB; setalpha = trueto randomize the alpha channelFormattingColor:FormattingColor.random(random: Random = Random): returns a random named formatting colorBossBarColor:BossBarColor.random(random: Random = Random): returns a random named bossbar color
Example usage:
They make it easy to generate example content, tests, or procedurally-generated visuals.
Serialization formats by context
Different Minecraft systems expect colors in different formats. Kore picks the right format automatically via serializers.
-
Chat components
color: string- Named colors emit lowercase names (e.g.
"red"). RGBemits"#rrggbb";ARGBemits"#aarrggbb".
- Named colors emit lowercase names (e.g.
-
Chat components
shadow_color: signed ARGB int (ColorAsARGBDecimalSerializer), colors without alpha being fully opaqueColor.BLUEemits-11184641(0xFF5555FF),argb(0, 0, 0, 0)emits0.
-
Item components (decimal ints):
dyedColor(..): decimal (or object withrgbdecimal when tooltip flag is present) See on GitHubpotionContents(customColor=..): decimal See on GitHub- Firework explosion
colors/fade_colors: decimal list See on GitHub
-
Worldgen Biomes (decimal ints):
effects.waterColor,effects.grassColor,effects.foliageColor, etc. use decimal ints.- Sky/fog/water fog colors are set via environment attributes (
attributes). See on GitHub
-
Particles:
- Particle options, in the
/particlecommand, enchantment effects and environment attributes (packed ints): RGB fordust,dust_color_transition,effect,instant_effectandtrail, ARGB forentity_effect,flashandtinted_leaves. A color without alpha is fully opaque, socolorParticle(Color.GREEN)givesparticle minecraft:entity_effect{color:-11141291}. See on GitHub
- Particle options, in the
-
UI and commands using named colors (strings):
- Teams, Scoreboards, Bossbar:
FormattingColor/BossBarColorSee on GitHub See on GitHub
- Teams, Scoreboards, Bossbar:
Dye colors and where they're used
DyeColors are used for entity variants and certain item/entity data components:
catCollar(..),wolfCollar(..),sheepColor(..),shulkerColor(..)See on GitHub See on GitHub See on GitHub See on GitHub
Practical examples
Chat components (string serialization):
Dyed leather color (decimal serialization):
Fireworks (decimal lists):
Biome effects (decimal):
Particles
- Dust, in the command (
particle minecraft:dust{color:16711680,scale:1.0f}), an enchantment or an environment attribute ("color": 16711680):
Entity variant dye usage:
Notes
- Passing
Colorto component helpers that use decimal or double-array formats is safe: Kore converts automatically viatoRGB(). - Use
DyeColorswhen the game mechanic expects a dye color (collars, sheep, shulkers, tropical fish), andFormattingColor/BossBarColorfor chat/UI tints.
Further reading
- Chat Components - Use colors in chat components
- Minecraft Wiki - Color
