question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Theme] Layer Styles

See original GitHub issue

Feature request

On Discord, the following question came up:

How can I specify coherent layer styles for light and dark mode? in regards to these docs.

Is your feature request related to a problem? Please describe.

This sounds like a great idea, but I’d prefer to not specify “success-light” and “success-dark”, and then decide which one I want to use in my client code.

Describe the solution you’d like

layerStyles should accept a function and be colormode-aware:

layerStyles: (props) => ({
  base: {
    bg: mode('gray.100', 'gray.900')(props),
  }
})

Additional context

theme.styles.global do this already.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

4reactions
segunadebayocommented, Feb 2, 2021

Thinking about this. I’d recommend using a className approach to solve this.

We append a className to document.body and you can leverage that className within the text and layer style. More like this:

const theme = {
   layerStyles: {
       base: {
           bg: "red.500",
           ".chakra-ui-dark &": {  bg: "red.300" }
      }
   }
}

Over time, we might encourage using this approach rather than the functional approach. I have some ideas around making this work but It might complicate the code a bit and I’d rather avoid it.

2reactions
dodascommented, Dec 10, 2020

I am talking about actually implementing it, so users can do it in the theme. I can’t see a way to access the colorScheme in the styleResolver function, so I could pass it to user’s theme.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Free Layer Styles designs, themes, templates and ... - Dribbble
Free Layer Styles. Inspirational designs, illustrations, and graphic elements from the world's best designers. Want more inspiration?
Read more >
Photoshop Layer Styles - Creative Market
Explore more than 2K Photoshop layer styles including paper, wood, neon, gold, and metal layer styles that make creating striking visuals a breeze....
Read more >
Introduction to Photoshop Layer Styles - Design & Illustration
Photoshop layer styles are a popular way to add effects, such as drop shadows and strokes, to layers in a non-destructive way. With...
Read more >
Text and Layer Styles - Chakra UI
Layer Styles allow you to save a combination of styling attributes to re-use in other components. Once created, pass the layerStyle prop to...
Read more >
Fantastic Collection Of Photoshop Layer Styles | 2022
10 Photoshop Text Effects By Artorious Design photoshop layer style · Dark Orb Layer Styles photoshop layer style · Vista Glass Style ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found