2019-09-05 17:47:50 +00:00
|
|
|
import * as styledComponents from "styled-components";
|
2019-09-22 20:25:05 +00:00
|
|
|
import { Colors, Color } from "./Colors";
|
2019-09-05 17:47:50 +00:00
|
|
|
import * as FontFamilies from "./Fonts";
|
2019-10-29 07:11:36 +00:00
|
|
|
import _ from "lodash";
|
2019-09-05 17:47:50 +00:00
|
|
|
|
|
|
|
|
export type FontFamily = (typeof FontFamilies)[keyof typeof FontFamilies];
|
2019-02-10 15:06:57 +00:00
|
|
|
|
|
|
|
|
const {
|
|
|
|
|
default: styled,
|
|
|
|
|
css,
|
|
|
|
|
keyframes,
|
|
|
|
|
createGlobalStyle,
|
2019-09-05 17:47:50 +00:00
|
|
|
ThemeProvider,
|
|
|
|
|
} = styledComponents as styledComponents.ThemedStyledComponentsModule<Theme>;
|
2019-02-10 15:06:57 +00:00
|
|
|
|
2019-10-08 09:09:30 +00:00
|
|
|
export type ThemeBorder = {
|
2019-10-28 13:20:33 +00:00
|
|
|
thickness: number;
|
2019-10-08 09:09:30 +00:00
|
|
|
style: "dashed" | "solid";
|
|
|
|
|
color: Color;
|
|
|
|
|
};
|
|
|
|
|
|
2019-10-21 11:40:24 +00:00
|
|
|
type PropertyPaneTheme = {
|
|
|
|
|
width: number;
|
|
|
|
|
height: number;
|
|
|
|
|
};
|
|
|
|
|
|
2019-09-05 17:47:50 +00:00
|
|
|
export type Theme = {
|
|
|
|
|
radii: Array<number>;
|
|
|
|
|
fontSizes: Array<number>;
|
2019-10-21 15:12:45 +00:00
|
|
|
drawerWidth: string;
|
2019-09-05 17:47:50 +00:00
|
|
|
spaces: Array<number>;
|
|
|
|
|
fontWeights: Array<number>;
|
|
|
|
|
colors: Record<string, Color>;
|
|
|
|
|
lineHeights: Array<number>;
|
|
|
|
|
fonts: Array<FontFamily>;
|
2019-10-08 09:09:30 +00:00
|
|
|
borders: ThemeBorder[];
|
2019-10-21 11:40:24 +00:00
|
|
|
propertyPane: PropertyPaneTheme;
|
2019-10-18 08:16:26 +00:00
|
|
|
headerHeight: string;
|
|
|
|
|
sidebarWidth: string;
|
2019-09-05 17:47:50 +00:00
|
|
|
};
|
2019-02-10 15:06:57 +00:00
|
|
|
|
2019-10-08 06:19:10 +00:00
|
|
|
export const getColorWithOpacity = (color: Color, opacity: number) => {
|
|
|
|
|
color = color.slice(1);
|
|
|
|
|
const val = parseInt(color, 16);
|
|
|
|
|
const r = (val >> 16) & 255;
|
|
|
|
|
const g = (val >> 8) & 255;
|
|
|
|
|
const b = val & 255;
|
|
|
|
|
return `rgba(${r},${g},${b},${opacity})`;
|
|
|
|
|
};
|
|
|
|
|
|
2019-10-29 07:11:36 +00:00
|
|
|
export const getBorderCSSShorthand = (border?: ThemeBorder) : string => {
|
|
|
|
|
let values : string[] = []
|
|
|
|
|
_.forIn(border, (value, key) => {
|
|
|
|
|
values.push(key === 'thickness' ? value + "px" : value)
|
|
|
|
|
})
|
|
|
|
|
return values.join(" ")
|
2019-10-08 09:09:30 +00:00
|
|
|
};
|
|
|
|
|
|
2019-09-05 17:47:50 +00:00
|
|
|
export const theme: Theme = {
|
2019-10-02 18:13:04 +00:00
|
|
|
radii: [0, 4, 8, 10, 20, 50],
|
2019-09-06 09:30:22 +00:00
|
|
|
fontSizes: [0, 10, 12, 14, 16, 18, 24, 28, 32, 48, 64],
|
2019-10-04 10:22:47 +00:00
|
|
|
spaces: [0, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 30],
|
2019-09-05 17:47:50 +00:00
|
|
|
fontWeights: [0, 400, 500, 700],
|
2019-10-21 11:40:24 +00:00
|
|
|
propertyPane: {
|
|
|
|
|
width: 250,
|
|
|
|
|
height: 600,
|
|
|
|
|
},
|
2019-10-21 15:12:45 +00:00
|
|
|
drawerWidth: "80%",
|
2019-09-05 17:47:50 +00:00
|
|
|
colors: {
|
|
|
|
|
primary: Colors.GREEN,
|
2019-10-21 15:12:45 +00:00
|
|
|
primaryDarker: Colors.JUNGLE_GREEN,
|
|
|
|
|
primaryDarkest: Colors.JUNGLE_GREEN_DARKER,
|
|
|
|
|
secondary: Colors.GEYSER_LIGHT,
|
|
|
|
|
secondaryDarker: Colors.CONCRETE,
|
|
|
|
|
secondaryDarkest: Colors.MERCURY,
|
2019-09-05 17:47:50 +00:00
|
|
|
error: Colors.RED,
|
2019-10-21 15:12:45 +00:00
|
|
|
info: Colors.SLATE_GRAY,
|
2019-09-06 11:40:00 +00:00
|
|
|
hover: Colors.POLAR,
|
2019-10-21 15:12:45 +00:00
|
|
|
inputInactiveBorders: Colors.MYSTIC,
|
|
|
|
|
inputInactiveBG: Colors.AQUA_HAZE,
|
2019-09-06 11:40:00 +00:00
|
|
|
textDefault: Colors.BLACK_PEARL,
|
2019-09-06 09:30:22 +00:00
|
|
|
textOnDarkBG: Colors.WHITE,
|
2019-09-06 11:40:00 +00:00
|
|
|
textAnchor: Colors.PURPLE,
|
|
|
|
|
border: Colors.GEYSER,
|
|
|
|
|
paneCard: Colors.SHARK,
|
Property Pane Controls
- Fixes #121, #122, #123, #124, #90, #46, #65, #100, #101, #68, #102
2019-10-24 05:24:45 +00:00
|
|
|
paneInputBG: Colors.SHARK,
|
2019-09-06 11:40:00 +00:00
|
|
|
paneBG: Colors.OUTER_SPACE,
|
Property Pane Controls
- Fixes #121, #122, #123, #124, #90, #46, #65, #100, #101, #68, #102
2019-10-24 05:24:45 +00:00
|
|
|
paneText: Colors.GRAY_CHATEAU,
|
|
|
|
|
paneSectionLabel: Colors.CADET_BLUE,
|
2019-10-18 08:16:26 +00:00
|
|
|
navBG: Colors.DEEP_SPACE,
|
2019-10-01 20:07:43 +00:00
|
|
|
grid: Colors.GEYSER,
|
|
|
|
|
containerBorder: Colors.FRENCH_PASS,
|
2019-10-18 08:16:26 +00:00
|
|
|
menuButtonBGInactive: Colors.JUNGLE_MIST,
|
|
|
|
|
menuIconColorInactive: Colors.OXFORD_BLUE,
|
2019-09-05 17:47:50 +00:00
|
|
|
},
|
|
|
|
|
lineHeights: [0, 14, 18, 22, 24, 28, 36, 48, 64, 80],
|
2019-09-06 09:30:22 +00:00
|
|
|
fonts: [FontFamilies.DMSans, FontFamilies.AppsmithWidget],
|
2019-09-22 20:25:05 +00:00
|
|
|
borders: [
|
|
|
|
|
{
|
2019-10-28 13:20:33 +00:00
|
|
|
thickness: 1,
|
2019-10-08 09:09:30 +00:00
|
|
|
style: "dashed",
|
|
|
|
|
color: Colors.FRENCH_PASS,
|
|
|
|
|
},
|
|
|
|
|
{
|
2019-10-28 13:20:33 +00:00
|
|
|
thickness: 2,
|
2019-10-01 20:07:43 +00:00
|
|
|
style: "solid",
|
|
|
|
|
color: Colors.FRENCH_PASS,
|
2019-09-22 20:25:05 +00:00
|
|
|
},
|
Property Pane Controls
- Fixes #121, #122, #123, #124, #90, #46, #65, #100, #101, #68, #102
2019-10-24 05:24:45 +00:00
|
|
|
{
|
2019-10-28 13:20:33 +00:00
|
|
|
thickness: 1,
|
Property Pane Controls
- Fixes #121, #122, #123, #124, #90, #46, #65, #100, #101, #68, #102
2019-10-24 05:24:45 +00:00
|
|
|
style: "solid",
|
|
|
|
|
color: Colors.GEYSER_LIGHT,
|
|
|
|
|
},
|
2019-09-22 20:25:05 +00:00
|
|
|
],
|
2019-10-25 05:35:20 +00:00
|
|
|
sidebarWidth: "350px",
|
2019-10-18 08:16:26 +00:00
|
|
|
headerHeight: "50px",
|
2019-09-05 17:47:50 +00:00
|
|
|
};
|
2019-02-10 15:06:57 +00:00
|
|
|
|
2019-09-05 17:47:50 +00:00
|
|
|
export { css, createGlobalStyle, keyframes, ThemeProvider };
|
|
|
|
|
export default styled;
|