This is a library that provides a Singleton class containing default colors specified in the:
- Material Color System.
- Flat UI Colors
- Apple Human Interface Guidelines
- Atlassian Design System
- Bootstrap
- Microsoft Fluent UI
- Official Brand Colors: A curated set of official colors from various mainstream companies such as Google, X (formerly Twitter), Instagram, and YouTube, ensuring brand consistency in your UI.
The DesignColors singleton provides easy access to a wide variety of predefined color palettes from major design systems and popular brands. Use it when you need:
- Direct access to Material, Flat UI, Apple, Atlassian, Bootstrap, Microsoft Fluent, or curated brand color palettes in Kotlin code or multi-platform Kotlin projects.
- To reference official colors from mainstream apps for personal projects, prototypes, or design consistency.
- A centralized color utility for apps where consistent color theming is important.
DesignColors includes utility functions and extensions to make working with colors in Kotlin simpler:
-
Color conversion support:
- Convert between Android
ColorInt
and Jetpack Compose Color.
- Convert between Android
-
Alpha transparency:
- Apply alpha (opacity) to colors using either integer or float values.
-
Color analysis:
- Determine if a color is light or dark.
-
RGB utilities:
- Extract RGB components or construct colors from RGB values.
-
Jetpack Compose extensions:
- Convert ColorInt values to Compose Color objects seamlessly.
current-version: v1.2.1
There are several ways to install this library.
Grab a JAR artifact from the Maven Central Repository:
//build.gradle.kts
implementation ("io.github.iodevblue:designcolors:${current-version}")
- If it is a snapshot version, add the Sonatype OSS Nexus snapshots repository.:
//build.gradle.kts
maven {
url = uri("https://central.sonatype.com/repository/maven-snapshots/")
}
- Then retrieve a copy:
//build.gradle.kts
implementation ("io.github.iodevblue:designcolors:${current-version}-SNAPSHOT")
Grab a JAR or AAR artifact from the release section.
Place it in libs
folder in your project module and install in your project.
//build.gradle.kts
implementation(fileTree("libs") { include("*.jar", "*.aar") })
To select Material Blue 50:
val blue50 = DesignColors.MaterialDesign.BLUE_50
Then apply it to a View or Widget:
val textView: TextView = findViewById(R.id.name_textview)
textView.background = blue50
You can convert the color to a Jetpack Compose Color and use in a composable:
Text(
text = "Exit",
modifier = modifier
.background(DesignColors.MaterialDesign.BLUE_300.toComposeColor(), shape = AbsoluteRoundedCornerShape(10.dp))
.padding(20.dp),
color = DesignColors.MaterialDesign.BLUE_50.toComposeColor()
)
To retrieve all Material Blue Colors in an Integer Array:
val blueColors = DesignColors.MaterialDesign.blueColorArray
To choose a random Material Blue Color:
val randomBlueColor = DesignColors.MaterialDesign.randomBlueColor()
To choose a random Material Color:
val randomMaterialColor = DesignColors.MaterialDesign.selectRandomColor()
To choose YouTube Red:
val youtubeRed = DesignColors.YouTube.RED
To select Snapchat Yellow:
val snapchatYellow = DesignColors.Snapchat.YELLOW
Design Colors is completely interoperable in Java.
To select Material Blue 50:
int blue50 = DesignColors.MaterialDesign.getBLUE_50();
To select Flat Design Midnight Blue 50:
int midNightBlue50 = DesignColors.FlatDesign.getMIDNIGHT_BLUE_50();
To select Facebook Messenger's Light Blue:
int midNightBlue50 = DesignColors.Facebook.Messenger.getLIGHT_BLUE();
Contributors are welcome!
If you would like to add your startup or company's official colors to this library, you can do so by contributing. Your additions help make this a more comprehensive and useful resource for designers and developers.
NOTE: This repository is organized into two branches:
- main branch: contains stable, finalized updates.
- development branch: used for active development and proposed changes.
Check the Contributing for more information.
- 1.2.1
- Added extensions to convert between Android colors and Jetpack Compose colors:
Int.toComposeColor()
– Converts an Android@ColorInt
Int to a Compose Color.Long.toComposeColor()
– Converts a packed ARGB Long to a Compose Color.Color.toColorInt()
– Converts a Jetpack Compose Color back to an Android @ColorInt Int.
- Added extensions to convert between Android colors and Jetpack Compose colors:
Check the CHANGELOG for all previous releases.
Copyright 2022-2025 IO DevBlue
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.