GithubHelp home page GithubHelp logo

t8rin / dynamictheme Goto Github PK

View Code? Open in Web Editor NEW
74.0 74.0 9.0 201 KB

๐ŸŽจ Jetpack Compose material theming library, which falls back onto a custom dynamic colors implementation based on wallpapers to support older API levels.

License: Apache License 2.0

Kotlin 80.49% Java 19.51%
android android-library colors composer-library dynamic-colors jetpack kotlin library material-design material-you material-you-3 theme ui ui-components

dynamictheme's Issues

Control color contrast for ColorTuple

I don't quite understand how to control the contrast of my colors. I have the following code but when I change the contrastLevel I end up with totally different colors

    val scheme = SchemeTonalSpot(Hct.fromInt(jsonToColorTuple(defaultColorTuple.value).surface!!.toArgb()), isDark = dark.value, contrastLevel = defaultContrast.value.toDouble())
    val colorTuple = ColorTuple(
            primary = Color(scheme.primaryPalette.hashCode()),
            secondary = Color(scheme.secondaryPalette.hashCode()),
            tertiary = Color(scheme.tertiaryPalette.hashCode()),
            surface = Color(scheme.neutralPalette.hashCode()),
        )
val ColorTuples: MutableMap<String, ColorTuple> = mutableMapOf(
    "Latte" to ColorTuple(
        primary = Color(0xFFE0E3E7),  // #E0E3E7 (Light Gray)
        secondary = Color(0xFFF3BCE6),  // #F3BCE6 (Pink)
        tertiary = Color(0xFFC29DF1),  // #C29DF1 (Purple)
        surface = Color(0xFFFCFCFC) // #FCFCFC (White)
    ),
    "Frappe" to ColorTuple(
        primary = Color(0xFFE78284),  // #E78284 (Pink)
        secondary = Color(0xFFC6D0F5),  // #C6D0F5 (Light Blue)
        tertiary = Color(0xFFA6D189),  // #A6D189 (Light Green)
        surface = Color(0xFFFCFCFC)   // #FCFCFC (White)
    ),
    "Macchiato" to ColorTuple(
        primary = Color(0xFF24273A),  // #24273A (Dark Gray)
        secondary = Color(0xFFF3BCE6),  // #F3BCE6 (Pink) - Lighter for contrast
        tertiary = Color(0xFFC29DF1),  // #C29DF1 (Purple) - Lighter for contrast
        surface = Color(0xFF1A1823)   // #1A1823 (Black)
    ),
    "Mocha" to ColorTuple(
        primary = Color(0xFF131020),  // #131020 (Black)
        secondary = Color(0xFFE0E3E7),  // #E0E3E7 (Light Gray) - Lighter for contrast
        tertiary = Color(0xFFC29DF1),  // #C29DF1 (Purple) - Lighter for contrast
        surface = Color(0xFF24273A)   // #24273A (Dark Gray)
    )
)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.