Skip to content

Commit cac288d

Browse files
authored
Merge pull request #200 from plotly/theming-updates
Update theming classes, theming document.
2 parents 37c2563 + 5a6b000 commit cac288d

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

THEMING.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ See if [you can use them](https://caniuse.com/#feat=css-variables).
1212

1313
### Sample
1414

15-
Here is a sample theme to change the UI from light to Dark.
15+
Here is a sample theme to change the UI from light to dark. We attach all of our custom properties to a `.plotly-editor--theme-provider` class name. If you want to have access to the variables in other sections of your application, you can add this class above your elements to put them in the same scope.
1616

1717
![editor-theme-example](https://user-images.githubusercontent.com/11803153/34530258-2dc6fcc0-f074-11e7-969b-b54327416b30.png)
1818

1919
```
2020
@import url('https://fonts.googleapis.com/css?family=Noto+Sans:400,700|Roboto+Mono:400,500,700');
2121
22-
.theme--dark .plotly-editor {
22+
.theme--dark .plotly-editor--theme-provider {
2323
/* Global Colors */
2424
--color-accent: hsl(205, 100%, 53%);
2525
--color-accent-shade-mid: hsl(205, 87%, 47%);
@@ -85,8 +85,8 @@ CSS custom properties are not supported in IE11. However, you can use a [PostCSS
8585
The PostCSS plugin we are using only applies to variables that are in the `:root{}` scope. If you'd like to both theme and use your styles to support IE11, you would need to import the unminified IE styles we ship with the editor:
8686
`import react-plotly.js-editor/lib/react-plotly.js-editor.ie.css` (this stylesheet has the variables attached to the `:root{}` scope).
8787

88-
Then, rather than applying your custom properties to `.theme--dark .plotly-editor`, you would apply your overrides to `:root`.
88+
Then, rather than applying your custom properties to `.theme--dark .plotly-editor--theme-provider`, you would apply your overrides to `:root{}`.
8989

90-
Finally, you would pipe in the PostCSS plugin(s) to your project and produce a css file with the properties applied as their true value. It's reccomended to use the [PostCSS Remove Root](https://github.com/cbracco/postcss-remove-root) plugin after you have converted all of the properties.
90+
Finally, you would pipe in the PostCSS plugin(s) to your project and produce a css file with the properties applied as their true value. It's recommended to use the [PostCSS Remove Root](https://github.com/cbracco/postcss-remove-root) plugin after you have converted all of the properties.
9191

9292
You can see our PostCSS scripts [here](https://github.com/plotly/react-plotly.js-editor/tree/master/scripts/postcss.js).

src/PlotlyEditor.js

+1
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ class PlotlyEditor extends Component {
133133
<div
134134
className={
135135
bem('plotly-editor') +
136+
' plotly-editor--theme-provider' +
136137
`${this.props.className ? ` ${this.props.className}` : ''}`
137138
}
138139
>

src/styles/main.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
@include generateVars;
1313
}
1414
} @else {
15-
.plotly-editor {
15+
.plotly-editor--theme-provider{
1616
@include generateVars;
1717
}
1818
}

0 commit comments

Comments
 (0)