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.

How to properly apply different carbon theme to part of app, e.g. White theme app with Gray 90 sidebar ?

See original GitHub issue

I haven’t got response on slack so I’m trying here.

Carbon v10 Q1: How to properly apply different carbon theme to part of app, e.g. White theme app with Gray 90 sidebar ? Sidebar will contain carbon components (Checkbox, Buttons etc). I’m using scss. Theme are defining how Carbon components are styled e.g. White theme Carbon Checkbox has black border, while Gray 90 theme Checkbox has white border. I don’t know how to use both themes.

Q2: How to achieve something like presented on link below, e.g. “White overflow menu on Gray 10 card.” ? https://www.carbondesignsystem.com/guidelines/color/overview#light-themes

What package(s) are you using?

"carbon-components": "10.4.1",
"carbon-components-react": "7.4.1",
"carbon-icons": "7.0.7",

Summary

Relevant information

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
mattrosnocommented, Aug 7, 2019

Hi @tomkdgun - happy to help. Here’s how I’d approach zoned theming in your Sass build. (The import paths are pretty crazy. We’re looking to clean those up in the future).

@import '~carbon-components/scss/globals/scss/vendor/@carbon/elements/scss/themes/theme-maps';

// set your default theme
$carbon--theme: $carbon--theme--white;

// build your default styling
@import '~carbon-components/src/globals/scss/styles.scss';

// build a zoned theme that is applied by using a namespace class
.theme-g90 {
  @include carbon--theme($carbon--theme--g90) {
    // import the components that you want emitted inside this theme
    @import button();
  }
}

This will result in some CSS bloat. You can use PostCSS to de-dup the theme-g90 CSS if you’d like, so those declarations only override colors. An example of doing that with Gulp is here: https://github.com/carbon-design-system/carbon/pull/1872#issuecomment-470278749


The better approach going forward will be leveraging custom properties (CSS variables) so you could apply zoned theming during runtime. That approach depends on your browser support (IE11). We’ll be documenting how to accomplish this soon.

0reactions
stale[bot]commented, Sep 9, 2019

As there’s been no activity since this issue was marked as stale, we are auto-closing it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Themes - Carbon Design System
To use the gray 10, gray 90, or gray 100 theme as your default instead of white, set the $carbon--theme variable to one...
Read more >
How to Change the Icons/Theme on Your Android Device
... it one step further by adding a custom theme for that launcher to change the icons for apps, skin the device, change...
Read more >
Introduction - TkDocs Tutorial
It provides all the essentials about core Tk concepts, the various widgets, layout, events and more that you need for your application.
Read more >
McKinsey Technology Trends Outlook 2022
today (see sidebar “About the McKinsey Technology Council”). ... mechanisms to ensure the proper use of resources (eg, predictive tools to ...
Read more >
v13.10 - foreflight mobile pilot guide transitioned
Carbon Monoxide (CO) Monitor . ... and Dark App Themes, and other app settings. ... From the outside (eg: if your aircraft is...
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