
Enhances theme management by offering predefined color palettes and easy customization options for consistent design across applications.
This library offers you compose color definitions and optionally also palettes for the colors.
[!NOTE] All features are splitted into separate modules, just include the modules you want to use!
![]() |
![]() |
| Module | android | iOS | windows | macOS | wasm | Notes |
|---|---|---|---|---|---|---|
| core | ✅ | ✅ | ✅ | ✅ | ✅ | provides all the basic classes |
| material | ✅ | ✅ | ✅ | ✅ | ✅ | provides constants for all material colors |
| material-palette | ✅ | ✅ | ✅ | ✅ | ✅ | provides a palette class for all material colors |
| x11 | ✅ | ✅ | ✅ | ✅ | ✅ | provides constants for all x11 colors |
| x11-palette | ✅ | ✅ | ✅ | ✅ | ✅ | provides a palette class for all x11 colors |
| Dependency | Version |
|---|---|
| Kotlin | 2.4.0 |
| Jetbrains Compose | 1.11.1 |
| Jetbrains Compose Material3 | 1.9.0 |
Define the dependencies inside your libs.versions.toml file.
[versions]
composecolors = "<LATEST-VERSION>"
[libraries]
composecolors-core = { module = "io.github.mflisar.composecolors:core", version.ref = "composecolors" }
composecolors-material = { module = "io.github.mflisar.composecolors:material", version.ref = "composecolors" }
composecolors-material-palette = { module = "io.github.mflisar.composecolors:material-palette", version.ref = "composecolors" }
composecolors-x11 = { module = "io.github.mflisar.composecolors:x11", version.ref = "composecolors" }
composecolors-x11-palette = { module = "io.github.mflisar.composecolors:x11-palette", version.ref = "composecolors" }And then use the definitions in your projects build.gradle.kts file like following:
implementation(libs.composecolors.core)
implementation(libs.composecolors.material)
implementation(libs.composecolors.material.palette)
implementation(libs.composecolors.x11)
implementation(libs.composecolors.x11.palette)Simply add the dependencies inside your build.gradle.kts file.
val composecolors = "<LATEST-VERSION>"
implementation("io.github.mflisar.composecolors:core:${composecolors}")
implementation("io.github.mflisar.composecolors:material:${composecolors}")
implementation("io.github.mflisar.composecolors:material-palette:${composecolors}")
implementation("io.github.mflisar.composecolors:x11:${composecolors}")
implementation("io.github.mflisar.composecolors:x11-palette:${composecolors}")// returns instance of `androidx.compose.ui.graphics.Color`
// Material Colors
val red500 = MaterialColor.Red500
val blue500 = MaterialColor.Blue500
// ...
// X11 Colors
val aliceBlue = X11.AliceBlue
val antiqueWhite = X11.AntiqueWhite
// ...
If desired, I offer *-palette modules that offer string names, enums and groups.
val palette = MaterialColor.Palette
when (palette) {
is ColorPalette.Definition -> {
// this palette does simple provide you a list of all available colors
val paletteName: String = palette.name
palette.colors.forEach {
val colorName: String = it.name // e.g. AliceBlue, AntiqueWhite, Aqua, ...
val color: Color = it.color
// ...
}
}
is ColorPalette.Grouped -> {
val paletteName: String = palette.name
palette.groups.forEach {
val groupName: String = it.name // e.g. Red, Green, Blue, ...
it.colors.forEach {
val colorName: String = it.name // e.g. Red500, Blue500, ...
val color: Color = it.color
// ...
}
}
}
}A full demo is included inside the demo module, it shows nearly every usage with working examples.
Check out the API documentation.
You can find more libraries (all multiplatform) of mine that all do work together nicely here.
This library offers you compose color definitions and optionally also palettes for the colors.
[!NOTE] All features are splitted into separate modules, just include the modules you want to use!
![]() |
![]() |
| Module | android | iOS | windows | macOS | wasm | Notes |
|---|---|---|---|---|---|---|
| core | ✅ | ✅ | ✅ | ✅ | ✅ | provides all the basic classes |
| material | ✅ | ✅ | ✅ | ✅ | ✅ | provides constants for all material colors |
| material-palette | ✅ | ✅ | ✅ | ✅ | ✅ | provides a palette class for all material colors |
| x11 | ✅ | ✅ | ✅ | ✅ | ✅ | provides constants for all x11 colors |
| x11-palette | ✅ | ✅ | ✅ | ✅ | ✅ | provides a palette class for all x11 colors |
| Dependency | Version |
|---|---|
| Kotlin | 2.4.0 |
| Jetbrains Compose | 1.11.1 |
| Jetbrains Compose Material3 | 1.9.0 |
Define the dependencies inside your libs.versions.toml file.
[versions]
composecolors = "<LATEST-VERSION>"
[libraries]
composecolors-core = { module = "io.github.mflisar.composecolors:core", version.ref = "composecolors" }
composecolors-material = { module = "io.github.mflisar.composecolors:material", version.ref = "composecolors" }
composecolors-material-palette = { module = "io.github.mflisar.composecolors:material-palette", version.ref = "composecolors" }
composecolors-x11 = { module = "io.github.mflisar.composecolors:x11", version.ref = "composecolors" }
composecolors-x11-palette = { module = "io.github.mflisar.composecolors:x11-palette", version.ref = "composecolors" }And then use the definitions in your projects build.gradle.kts file like following:
implementation(libs.composecolors.core)
implementation(libs.composecolors.material)
implementation(libs.composecolors.material.palette)
implementation(libs.composecolors.x11)
implementation(libs.composecolors.x11.palette)Simply add the dependencies inside your build.gradle.kts file.
val composecolors = "<LATEST-VERSION>"
implementation("io.github.mflisar.composecolors:core:${composecolors}")
implementation("io.github.mflisar.composecolors:material:${composecolors}")
implementation("io.github.mflisar.composecolors:material-palette:${composecolors}")
implementation("io.github.mflisar.composecolors:x11:${composecolors}")
implementation("io.github.mflisar.composecolors:x11-palette:${composecolors}")// returns instance of `androidx.compose.ui.graphics.Color`
// Material Colors
val red500 = MaterialColor.Red500
val blue500 = MaterialColor.Blue500
// ...
// X11 Colors
val aliceBlue = X11.AliceBlue
val antiqueWhite = X11.AntiqueWhite
// ...
If desired, I offer *-palette modules that offer string names, enums and groups.
val palette = MaterialColor.Palette
when (palette) {
is ColorPalette.Definition -> {
// this palette does simple provide you a list of all available colors
val paletteName: String = palette.name
palette.colors.forEach {
val colorName: String = it.name // e.g. AliceBlue, AntiqueWhite, Aqua, ...
val color: Color = it.color
// ...
}
}
is ColorPalette.Grouped -> {
val paletteName: String = palette.name
palette.groups.forEach {
val groupName: String = it.name // e.g. Red, Green, Blue, ...
it.colors.forEach {
val colorName: String = it.name // e.g. Red500, Blue500, ...
val color: Color = it.color
// ...
}
}
}
}A full demo is included inside the demo module, it shows nearly every usage with working examples.
Check out the API documentation.
You can find more libraries (all multiplatform) of mine that all do work together nicely here.