Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

112
Views
Customize ContentAlpha in Jetpack Compose like a theme

My Customer has very strict design guidelines, e.g. for alpha: Text should have no alpha.

However, I can't seem to customize MaterialDesign´s alpha in a theme like way.

Sure, I can customize each and every component, but this is tedious: Modifier.alpha(1.0f)

Sure, I can wrap my whole app in an alpha-Provider, but most material-components overwrite it, e.g. AppBar, so this doesn't work as expected either.

// my wrapper:
CompositionLocalProvider(LocalContentAlpha provides 1.0f) { /* my ui */ }

// will be overwritten by 
@Composable
private fun AppBar(...) {
    Surface(...) {
        CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
            Row(..., content)
        }
    }
}

So I guess what I should be doing is providing a custom ContentAlpha, since it is used in nearly every material component, but I don't know how to. Do you?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

It seems to me like you don't really need material design and want to just go custom theme. It's fine, really, I'm currently working on production app that went in that direction and it's completely workable.

We are still wrapping our content with MaterialTheme to make SOME of material components available, but the material dependency is internal to base ui module. So if we want to use any material component in UI code (in feature for example) - we have to create our wrapper for it. This way we are using only our code in UI without loosing some of material components. And if material design will change in a way we cannot accept it - we can just reimplement the thin wrapper to something 100% custom (like we did with Button and text fields).

You can override any part of material component within those thin wrappers using Modifier.alpha(1.0f). You are doing it once and then forget about that :)

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!