Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
[Feat] Add more light themes (#1001)
Shan Hef917b49516dd
diff --git a/README.md b/README.mdindex b0f890411..cbf0cf9bf 100644--- a/README.md+++ b/README.md@@ -241,8 +241,11 @@ Read more about [Components][components].- default: `null`+One of `"dark"`, `"light"` or `"base"`You can pass theme name or object used to customize Kepler.gl style. Kepler.gl provide an `'light'` theme besides the default 'dark' theme. When pass in a theme object Kepler.gl will use the value passed as input to override values from [theme](https://github.com/keplergl/kepler.gl/blob/master/src/styles/base.js).+Read more about [Custom Theme][custom-theme]+#### `mapboxApiUrl` (String, optional)- Default: `https://api.mapbox.com`@@ -632,6 +635,7 @@ Read more about [addDataToMap](./docs/api-reference/actions/actions.md#adddatato[get-started]: ./docs/api-reference/get-started.md[reducers]: ./docs/api-reference/reducers/overview.md[components]: ./docs/api-reference/components/overview.md+[custom-theme]: ./docs/api-reference/custom-theme/overview.md[reducers]: ./docs/api-reference/reducers/overview.md[actions-updaters]: ./docs/api-reference/actions/overview.md[processors]: ./docs/api-reference/processors/overview.mddiff --git a/docs/api-reference/custom-theme/overview.md b/docs/api-reference/custom-theme/overview.mdnew file mode 100644index 000000000..230c6dc89--- /dev/null+++ b/docs/api-reference/custom-theme/overview.md@@ -0,0 +1,25 @@+# Custom Theme++You can pass theme name or object used to customize Kepler.gl style. Kepler.gl provide an `'light'` theme besides the default 'dark' theme. When pass in a theme object Kepler.gl will use the value passed as input to overwrite values from [theme](https://github.com/keplergl/kepler.gl/blob/master/src/styles/base.js).+++```js+import KeplerGl from 'kepler.gl';++const Map = props => (+ <KeplerGl+ id="foo"+ width={width}+ mapboxApiAccessToken={token}+ height={height}+ theme="light"+ />+);+```++### Available Themes+| theme | |+| ------- | ------- |+| `dark` (default) |  |+| `light` |  |+| `base` |  |diff --git a/src/components/common/field-selector.js b/src/components/common/field-selector.jsindex d5f4a6bb1..72cc5c42f 100644--- a/src/components/common/field-selector.js+++ b/src/components/common/field-selector.js@@ -29,12 +29,6 @@ import {classList} from './item-selector/dropdown-list';const defaultDisplayOption = d => d.name;-const StyledFieldItem = styled.div`- .${classList.listItemAnchor} {- color: white;- }-`;-const StyledToken = styled.div`display: inline-block;margin: 0 4px 0 0;@@ -42,14 +36,14 @@ const StyledToken = styled.div`// custom list Itemexport const FieldListItemFactory = (showToken = true) => {const FieldListItem = ({value, displayOption = defaultDisplayOption}) => (- <StyledFieldItem>+ <div>{showToken ? (<StyledToken><FieldToken type={value.type} /></StyledToken>) : null}<span className={classList.listItemAnchor}>{displayOption(value)}</span>- </StyledFieldItem>+ </div>);return FieldListItem;diff --git a/src/components/common/logo.js b/src/components/common/logo.jsindex 2be53f063..445e1ee06 100644--- a/src/components/common/logo.js+++ b/src/components/common/logo.js@@ -30,7 +30,7 @@ const LogoTitle = styled.div`const LogoName = styled.div`.logo__link {- color: ${props => props.theme.activeColor};+ color: ${props => props.theme.logoColor};font-size: 14px;font-weight: 600;letter-spacing: 1.17px;diff --git a/src/components/common/styled-components.js b/src/components/common/styled-components.jsindex 74075d337..937be68d8 100644--- a/src/components/common/styled-components.js+++ b/src/components/common/styled-components.js@@ -192,6 +192,8 @@ export const Button = styled.div.attrs({? props.theme.secondaryBtnBgd: props.link? props.theme.linkBtnBgd+ : props.floating+ ? props.theme.floatingBtnBgd: props.theme.primaryBtnBgd};border-radius: ${props => props.theme.primaryBtnRadius};color: ${props =>@@ -201,6 +203,8 @@ export const Button = styled.div.attrs({? props.theme.secondaryBtnColor: props.link? props.theme.linkBtnColor+ : props.floating+ ? props.theme.floatingBtnColor: props.theme.primaryBtnColor};cursor: pointer;display: inline-flex;@@ -229,6 +233,8 @@ export const Button = styled.div.attrs({? props.theme.secondaryBtnBgdHover: props.link? props.theme.linkBtnActBgdHover+ : props.floating+ ? props.theme.floatingBtnBgdHover: props.theme.primaryBtnBgdHover};color: ${props =>props.negative@@ -237,6 +243,8 @@ export const Button = styled.div.attrs({? props.theme.secondaryBtnActColor: props.link? props.theme.linkBtnActColor+ : props.floating+ ? props.theme.floatingBtnActColor: props.theme.primaryBtnActColor};}@@ -558,33 +566,28 @@ export const BottomWidgetInner = styled.div`margin-top: ${props => props.theme.bottomPanelGap}px;`;-export const MapControlButton = styled.div.attrs({+export const MapControlButton = styled(Button).attrs({className: 'map-control-button'})`- align-items: center;- background-color: ${props =>- props.active ? props.theme.panelBackgroundHover : props.theme.panelBackground};- border: 0;box-shadow: 0 6px 12px 0 rgba(0, 0, 0, 0.16);- color: ${props => props.theme.primaryBtnColor};- cursor: pointer;- display: flex;height: 32px;- justify-content: center;- margin: 0;- outline: none;- padding: 0;- transition: ${props => props.theme.transition};width: 32px;+ padding: 0;+ border-radius: 0;+ background-color: ${props =>+ props.active ? props.theme.floatingBtnBgdHover : props.theme.floatingBtnBgd};+ color: ${props =>+ props.active ? props.theme.floatingBtnActColor : props.theme.floatingBtnColor};- :focus {- outline: none;+ :hover,+ :focus,+ :active,+ &.active {+ background-color: ${props => props.theme.floatingBtnBgdHover};+ color: ${props => props.theme.floatingBtnActColor};}-- :hover {- cursor: pointer;- background-color: ${props => props.theme.secondaryBtnActBgd};- color: ${props => props.theme.secondaryBtnActColor};+ svg {+ margin-right: 0;}`;diff --git a/src/components/kepler-gl.js b/src/components/kepler-gl.jsindex 3267bb9e2..b3440e488 100644--- a/src/components/kepler-gl.js+++ b/src/components/kepler-gl.js@@ -54,7 +54,7 @@ import NotificationPanelFactory from './notification-panel';import {generateHashId} from 'utils/utils';import {validateToken} from 'utils/mapbox-utils';-import {theme as basicTheme, themeLT} from 'styles/base';+import {theme as basicTheme, themeLT, themeBS} from 'styles/base';// Maybe we should think about exporting this or creating a variable// as part of the base.js theme@@ -149,6 +149,8 @@ function KeplerGlFactory(}: theme === THEME.light? themeLT+ : theme === THEME.base+ ? themeBS: theme);diff --git a/src/components/side-panel/common/dataset-title.js b/src/components/side-panel/common/dataset-title.jsindex d9a20642f..41ec399d8 100644--- a/src/components/side-panel/common/dataset-title.js+++ b/src/components/side-panel/common/dataset-title.js@@ -43,12 +43,12 @@ const StyledDatasetTitle = styled.div`}.dataset-action {- color: ${props => props.theme.textColorHl};+ color: ${props => props.theme.textColor};opacity: 1;}.dataset-action:hover {- color: white;+ color: ${props => props.theme.textColorHl};}}`;diff --git a/src/components/side-panel/layer-panel/layer-panel-header.js b/src/components/side-panel/layer-panel/layer-panel-header.jsindex 5c5daa7ec..a1b38ff57 100644--- a/src/components/side-panel/layer-panel/layer-panel-header.js+++ b/src/components/side-panel/layer-panel/layer-panel-header.js@@ -67,7 +67,7 @@ const StyledLayerPanelHeader = styled(StyledPanelHeader)`}.layer__enable-config {- color: white;+ color: ${props => props.theme.textColorHl};}}`;diff --git a/src/components/side-panel/panel-header.js b/src/components/side-panel/panel-header.jsindex eeeff8adc..ee6d97d00 100644--- a/src/components/side-panel/panel-header.js+++ b/src/components/side-panel/panel-header.js@@ -73,7 +73,6 @@ const StyledPanelAction = styled.div.attrs({:hover {cursor: pointer;- background-color: ${props => props.theme.secondaryBtnActBgd};color: ${props => props.theme.textColorHl};a {diff --git a/src/constants/default-settings.js b/src/constants/default-settings.jsindex 84dfba427..18e603592 100644--- a/src/constants/default-settings.js+++ b/src/constants/default-settings.js@@ -145,7 +145,8 @@ export const DIMENSIONS = {*/export const THEME = keyMirror({light: null,- dark: null+ dark: null,+ base: null});export const SIDEBAR_PANELS = [diff --git a/src/styles/base.js b/src/styles/base.jsindex e833f9517..0f1a66cf8 100644--- a/src/styles/base.js+++ b/src/styles/base.js@@ -52,8 +52,10 @@ export const titleTextColor = '#FFFFFF';export const textColorHl = '#F0F0F0';export const textColorHlLT = '#F1F1F1';export const activeColor = '#1FBAD6';+export const activeColorLT = '#2473BD';export const activeColorHover = '#108188';export const errorColor = '#F9042C';+export const logoColor = activeColor;// Buttonexport const primaryBtnBgd = '#0F9668';@@ -81,6 +83,12 @@ export const negativeBtnBgdHover = '#FF193E';export const negativeBtnColor = '#FFFFFF';export const negativeBtnActColor = '#FFFFFF';+export const floatingBtnBgd = '#29323C';+export const floatingBtnActBgd = '#3A4552';+export const floatingBtnBgdHover = '#3A4552';+export const floatingBtnColor = subtextColor;+export const floatingBtnActColor = subtextColorActive;+// Inputexport const inputBoxHeight = '34px';export const inputBoxHeightSmall = '24px';@@ -939,6 +947,12 @@ export const theme = {linkBtnActColor,linkBtnActBgdHover,+ floatingBtnBgd,+ floatingBtnActBgd,+ floatingBtnBgdHover,+ floatingBtnColor,+ floatingBtnActColor,+// ModalmodalTitleColor,modalTitleFontSize,@@ -1000,6 +1014,7 @@ export const theme = {titleColorLT,tooltipBg,tooltipColor,+ logoColor,// Bottom PanelbottomInnerPdSide,@@ -1064,35 +1079,131 @@ export const theme = {export const themeLT = {...theme,-// template+ activeColor: activeColorLT,input: inputLT,textColor: textColorLT,- sidePanelBg: '#ffffff',+ sidePanelBg: '#FFFFFF',+ selectColor: selectColorLT,titleTextColor: '#000000',- sidePanelHeaderBg: '#f7f7F7',- subtextColorActive: '#2473bd',- tooltipBg: '#1869b5',- tooltipColor: '#ffffff',- dropdownListBgd: '#ffffff',- textColorHl: '#2473bd',- inputBgd: '#f7f7f7',- inputBgdHover: '#ffffff',- inputBgdActive: '#ffffff',- dropdownListHighlightBg: '#f0f0f0',- panelBackground: '#f7f7F7',- panelBackgroundHover: '#f7f7F7',+ sidePanelHeaderBg: '#F7F7F7',+ subtextColorActive: activeColorLT,+ tooltipBg: '#1869B5',+ tooltipColor: '#FFFFFF',+ dropdownListBgd: '#FFFFFF',+ textColorHl: activeColorLT,++ inputBgd: '#F7F7F7',+ inputBgdHover: '#FFFFFF',+ inputBgdActive: '#FFFFFF',++ dropdownListHighlightBg: '#F0F0F0',++ panelBackground: '#F7F7F7',+ panelBackgroundHover: '#F7F7F7',panelBorderColor: '#D3D8E0',- secondaryInputBgd: '#f7f7F7',- secondaryInputBgdActive: '#f7f7F7',- secondaryInputBgdHover: '#ffffff',- panelActiveBg: '#f7f7F7',- mapPanelBackgroundColor: '#ffffff',- mapPanelHeaderBackgroundColor: '#f7f7F7',++ secondaryInputBgd: '#F7F7F7',+ secondaryInputBgdActive: '#F7F7F7',+ secondaryInputBgdHover: '#FFFFFF',+ secondaryInputBorderActiveColor: '#000000',+ secondaryInputBorderColor: 'none',+ secondaryInputColor: '#545454',++ panelActiveBg: '#F7F7F7',+ mapPanelBackgroundColor: '#FFFFFF',+ mapPanelHeaderBackgroundColor: '#F7F7F7',++ sliderBarColor: '#A0A7B4',sliderBarBgd: '#D3D8E0',- secondarySwitchBtnBgd: '#D3D8E0',+ sliderHandleColor: '#F7F7F7',+ sliderHandleHoverColor: '#F7F7F7',++ subtextColor: subtextColorLT,+ switchBtnBgd: '#F7F7F7',+ secondarySwitchBtnBgd: '#F7F7F7',+ secondarySwitchTrackBgd: '#D3D8E0',+ switchBtnBgdActive: '#F7F7F7',switchTrackBgd: '#D3D8E0',+ switchTrackBgdActive: activeColorLT,- // button- linkBtnActColor: textColorLT+ // button switch background and hover color+ primaryBtnBgd: primaryBtnActBgd,+ primaryBtnActBgd: primaryBtnBgd,+ primaryBtnBgdHover: primaryBtnBgd,++ secondaryBtnBgd: secondaryBtnActBgd,+ secondaryBtnActBgd: secondaryBtnBgd,+ secondaryBtnBgdHover: secondaryBtnBgd,++ floatingBtnBgd: '#F7F7F7',+ floatingBtnActBgd: '#F7F7F7',+ floatingBtnBgdHover: '#F7F7F7',+ floatingBtnColor: subtextColor,+ floatingBtnActColor: activeColorLT,++ linkBtnActColor: textColorLT,++ rangeBrushBgd: '#D3D8E0',+ histogramFillInRange: activeColorLT,+ histogramFillOutRange: '#A0A7B4'+};++export const themeBS = {+ ...theme,+ activeColor: '#E2E2E2',+ dropdownListBgd: '#FFFFFF',+ dropdownListBorderTop: 'none',+ dropdownListHighlightBg: '#F6F6F6',+ inputBgd: '#E2E2E2',+ inputBgdActive: '#E2E2E2',+ inputBgdHover: 'inherit',+ inputBorderActiveColor: '#000000',+ inputColor: '#000000',+ panelActiveBg: '#E2E2E2',+ panelBackground: '#FFFFFF',+ panelBackgroundHover: '#EEEEEE',+ panelBorderColor: '#E2E2E2',+ primaryBtnBgd: '#E2E2E2',+ primaryBtnBgdHover: '#333333',+ primaryBtnColor: '#000000',+ secondaryBtnActBgd: '#EEEEEE',+ secondaryBtnActColor: '#000000',+ secondaryBtnBgd: '#E2E2E2',+ secondaryBtnBgdHover: '#CBCBCB',++ floatingBtnBgd: '#FFFFFF',+ floatingBtnActBgd: '#EEEEEE',+ floatingBtnBgdHover: '#EEEEEE',+ floatingBtnColor: '#AFAFAF',+ floatingBtnActColor: '#000000',++ secondaryBtnColor: '#000000',+ secondaryInputBgd: '#F6F6F6',+ secondaryInputBgdActive: '#F6F6F6',+ secondaryInputBgdHover: '#F6F6F6',+ secondaryInputBorderActiveColor: '#000000',+ secondaryInputBorderColor: 'none',+ secondaryInputColor: '#545454',+ sidePanelBg: '#F6F6F6',+ sidePanelHeaderBg: '#FFFFFF',+ subtextColor: '#AFAFAF',+ subtextColorActive: '#000000',+ textColor: '#000000',+ textColorHl: '#545454',+ mapPanelBackgroundColor: '#F6F6F6',+ mapPanelHeaderBackgroundColor: '#FFFFFF',+ titleTextColor: '#000000',+ switchBtnBgdActive: '#000000',+ switchBtnBgd: '#FFFFFF',+ switchTrackBgdActive: '#E2E2E2',+ secondarySwitchTrackBgd: '#E2E2E2',+ switchTrackBgd: '#E2E2E2',+ secondarySwitchBtnBgd: '#FFFFFF',+ histogramFillInRange: '#000000',+ histogramFillOutRange: '#E2E2E2',+ rangeBrushBgd: '#E2E2E2',+ sliderBarBgd: '#E2E2E2',+ sliderHandleColor: '#FFFFFF',+ sliderBarColor: '#000000'};