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.

[styles] Easily allow separate on- and off- Paper styling

See original GitHub issue
  • I have searched the issues of this repository and believe that this is not a duplicate.

Summary šŸ’”

Weā€™re creating a custom material-ui theme that will live on a blue-ish background. All components that will live on it will use the ā€œdarkā€ theme provided in the docs: white text, white Inputs and Selects.

However, the Paper component will remain white, instead of the dark-grey used in the regular dark theme. This creates an issue where, when using any component on Paper, they will be styled in white, whereas weā€™d want those components to have a regular black-on-white color.

In the theme, this is what I mean:

createTheme({
  palette: {
    type: 'dark', // Causes color issues on Paper
    background: {
      default: 'blue',
      paper: 'white', // The twist from regular dark theme
    },
    text: whiteVersion, // Causes color issues on Paper
    action: whiteVersion, // Causes color issues on Paper
  }
})

It could be solved if I could provide a theme to all nested Paper components, but I donā€™t think thereā€™s a way to do that?

Examples

Quite simply, a blue background, with a dark-themed Select (white caret and borders), that opens a list of options on light-themed Paper (white paper with black text).

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Floriferouscommented, Aug 18, 2020

The thing is I never actually use the Paper component directly, Iā€™m talking about other components using Paper, like Menu inside of a Select.

0reactions
Floriferouscommented, Aug 19, 2020

Well yes, I understand why things currently happen this way, but do you understand my use case?

Iā€™d like to keep Dropdowns, Menus, Dialogs, Cards, etc. to preserve their white background, while the rest of the app lives on a color that requires Dark styling.

And to address your last comment specifically: I keep the background.default to a dark-ish color, but background.paper remains white. Maybe this is an ā€œillegalā€ setup according to you?

A complex thing like this could solve it: allow nested palette objects in createTheme, but itā€™s a bit weird:

createTheme({
  palette: {
    type: 'dark', // Causes color issues on Paper
    background: {
      default: 'blue',
      paper: 'white', // The twist from regular dark theme
    },
    text: whiteVersion, // Causes color issues on Paper
    action: whiteVersion, // Causes color issues on Paper
  },
  overrides: {
    MuiPaper: {
      palette: {
        type: 'light',
        text: blackVersion,
        action: blackVersion,
      }
    }
  }
})

To me this is a feature request, not a support ticket, since this theme appears not to be possible right now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Word 2016: Applying and Modifying Styles - GCF Global
In the Styles group on the Home tab, right-click the style you want to change and select Modify from the drop-down menu. selecting...
Read more >
Customize or create new styles - Microsoft Support
Create a new style based on document formatting Ā· Right-click the text on which you want to base a new style, point to...
Read more >
Apply styles - Microsoft Support
Select text and apply a style such as a title, header, or paragraph using the Styles gallery. ... Styles give your document a...
Read more >
Video: Using Styles in Word - Microsoft Support
Here's a better way to get your document looking smart: Quick Styles. Give it a try by clicking the Style buttons in the...
Read more >
How To Set Up A Print Style Sheet - Smashing Magazine
The good news is that a print style sheet is actually very easy to craft: ... Building print styles separately from screen styles...
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