Skip to content

A Kotlin library offering a comprehensive collection of predefined color palettes from major design systems and popular brands. Includes palettes from Material Design, Flat UI, Apple HIG, Atlassian, Bootstrap, Microsoft Fluent UI and curated brand colors (Google, Twitter, Netflix, Instagram etc)

License

Notifications You must be signed in to change notification settings

IODevBlue/DesignColors

Repository files navigation

DesignColors

Current Version Repo Size License Stars Gradle Kotlin

This is a library that provides a Singleton class containing default colors specified in the:

Table of content

Uses

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.

Features

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.
  • 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.

Installation

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") })

Material Design Colors

Material Design Color Chart

Usage

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()

Special

To choose YouTube Red:

val youtubeRed = DesignColors.YouTube.RED 

To select Snapchat Yellow:

val snapchatYellow = DesignColors.Snapchat.YELLOW

Java Interoperability

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();

Contributions

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.

Changelog

  • 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.

Check the CHANGELOG for all previous releases.

License

    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.

About

A Kotlin library offering a comprehensive collection of predefined color palettes from major design systems and popular brands. Includes palettes from Material Design, Flat UI, Apple HIG, Atlassian, Bootstrap, Microsoft Fluent UI and curated brand colors (Google, Twitter, Netflix, Instagram etc)

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Contributors 2

  •  
  •