Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Commit

Permalink
fix: Theming fix & Remove unused
Browse files Browse the repository at this point in the history
  • Loading branch information
attitude committed Jul 27, 2023
1 parent 5f19e70 commit 18e353a
Show file tree
Hide file tree
Showing 23 changed files with 7 additions and 1,154 deletions.
29 changes: 0 additions & 29 deletions docs/admin/theming/luminances.mdx

This file was deleted.

63 changes: 0 additions & 63 deletions docs/admin/theming/schemes.mdx

This file was deleted.

8 changes: 4 additions & 4 deletions src/theming/Components/Generator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
ThemeName,
WHITE_SPACE
} from "../Config"
import { copyTextToClipboard, cssToSASS, indentText } from "../Helpers"
import { copyTextToClipboard, indentText } from "../Helpers"
import { scaleGradient, scaleToCSSProperties, scaleToColorWeightMap } from "../Scale"
import { ColorInput } from './ColorInput'
import { Scale } from "./Scale"
Expand Down Expand Up @@ -161,7 +161,7 @@ function themeEntriesToCSS(themeEntries: ThemeEntries) {
return `:where(.cui-root) {\n${themeEntries
.map(
([name, [lightHex, middleHex, hex]]) =>
`${WHITE_SPACE}/* ${name}: [${lightHex}, ${middleHex}, ${hex}] */\n${WHITE_SPACE}${indentText(
`${WHITE_SPACE}/* ${name}: [${lightHex}, ${middleHex}, ${hex}] */\n${indentText(
scaleToCSSProperties(
`${PREFIX}-theme-${name}-rgb`,
scaleToColorWeightMap(scaleGradient(lightHex, middleHex, hex))
Expand Down Expand Up @@ -223,7 +223,7 @@ export const Generator = React.memo(() => {
await copyTextToClipboard(allCSSResult);
}, [allCSSResult])
return (
<Stack direction='vertical' className="theming-generator scheme-system">
<Stack className="cui-root theming-generator scheme-system">
<Stack align="center" direction="horizontal" className="sm:flex-wrap">
<Button className="sm:flex-grow" disabled={changedThemeEntries.length === 0} distinction="primary" onClick={copyCSSToClipboard}>Copy CSS</Button>
{verbose && <Button distinction="outlined" onClick={copyAllCSSToClipboard}>Copy All CSS</Button>}
Expand All @@ -239,7 +239,7 @@ export const Generator = React.memo(() => {
onThemesChange={onThemesChange}
/>
{verbose && <div className="is-visible-style">{cssResult}</div>}
<style>{themeEntriesToCSS(themeEntries)}</style>
<style>{allCSSResult}</style>
</Stack>
)
})
Expand Down
2 changes: 1 addition & 1 deletion src/theming/Components/Scale.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
content: "*";
display: inline-block;
margin-left: 0.4em;
color: rgb(var(--cui-theme-danger-500))
color: rgb(var(--cui-theme-danger-rgb-500))
}

.theming-scale.is-dirty .theming-scale-label-theme-name-action {
Expand Down
2 changes: 1 addition & 1 deletion src/theming/Components/Scale.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const Scale = ({ actions, children, className, elevated, name, direction
>
{weights.map(weight => <Swatch
key={weight}
property={`--cui-theme-${name}-${weight}`}
property={`--cui-theme-${name}-rgb-${weight}`}
weight={weight}
>
{verbose ? <small>{weight}</small> : null}
Expand Down
94 changes: 1 addition & 93 deletions src/theming/Config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { ColorSchemeOffsets } from "./Types";

export const PREFIX = "cui";
export const WHITE_SPACE = "\t";

Expand Down Expand Up @@ -58,95 +56,5 @@ export const CONTEMBER_THEMES: {[Property in ThemeName]: [string, string, string
success: ["#6EBB00", "#6EBB00", "#6EBB00"],
warn: ["#FF6600", "#FF6600", "#FF6600"], //"#EC9117",
danger: ["#FF004C", "#FF4D00", "#FF0000"], //"#FF4827",
default: ["#999999", "#999999", "#999999"]
default: ["#8494A4", "#8494A4", "#8494A4"]
})

export const c5 = -4; // -4; // 8
export const c4 = -14; // -15; // 0
export const c3 = 6; // 6; // 0
export const c2 = 180; // 180; // 90
export const c1 = 100; // 100; // 68

export const colorSchemeWeightOffsets: ColorSchemeOffsets = {
light: {
color: -875,
controlColor: -575,
controlColorHighlighted: -575,
controlColorPressed: -650,
controlBorderColor: -500,
controlBorderColorHighlighted: -575,
controlBackgroundColor: 0,
controlBackgroundColorHighlighted: 250,
filledControlColor: -575,
filledControlColorHighlighted: -525,
filledControlColorPressed: -775,
filledControlBorderColorPressed: -775,
filledControlBackroundColor: 50,
filledControlBackgroundColorHighlighted: 75,
filledControlBackgroundColorPressed: -600,
filledPrimaryControlColor: 50,
filledPrimaryControlColorHighlighted: 400,
filledPrimaryControlColorPressed: -200,
filledPrimaryControlBorderColorPressed: -200,
filledPrimaryControlBackroundColor: -600,
filledPrimaryControlBackgroundColorHighlighted: -550,
filledPrimaryControlBackgroundColorPressed: -600,
tonedControlColorWeight: -700,
tonedControlColorWeightHighlighed: -300,
tonedControlBackgroundColor: -125,
tonedControlBackgroundColorHighlighed: 100
},
dark: {
color: 975,
controlColor: 575,
controlColorHighlighted: 900,
controlColorPressed: 550,
controlBorderColor: 550,
controlBorderColorHighlighted: 900,
controlBackgroundColor: -150,
controlBackgroundColorHighlighted: 250,
filledControlColor: 650,
filledControlColorHighlighted: 1000,
filledControlColorPressed: 650,
filledControlBorderColorPressed: 650,
filledControlBackroundColor: 125,
filledControlBackgroundColorHighlighted: 250,
filledControlBackgroundColorPressed: 125,
filledPrimaryControlColor: 1000,
filledPrimaryControlColorHighlighted: 1000,
filledPrimaryControlColorPressed: 600,
filledPrimaryControlBorderColorPressed: 650,
filledPrimaryControlBackroundColor: 275,
filledPrimaryControlBackgroundColorHighlighted: 350,
filledPrimaryControlBackgroundColorPressed: 125,
tonedControlColorWeight: 850,
tonedControlColorWeightHighlighed: 950,
tonedControlBackgroundColor: 250,
tonedControlBackgroundColorHighlighed: 325
}
}

export const colorSchemesOpacities: ColorSchemeOffsets = {
light: {
high: -0.25,
medium: -0.50,
low: -0.7,
lower: -0.875,
controlBackgroundColor: -0.75,
controlBackgroundColorHighlighted: -0.25,
filledControlBackgroundColorPressed: -0.5,
tonedControlBackgroundColor: -0.75,
tonedControlBackgroundColorHighlighted: -0.5 / 2,
},
dark: {
high: -0.25,
medium: -0.50,
low: -0.7,
lower: -0.875,
controlBackgroundColor: -0.75,
controlBackgroundColorHighlighted: -0.25,
filledControlBackgroundColorPressed: -0.5,
tonedControlBackgroundColor: -0.5,
tonedControlBackgroundColorHighlighted: -0.25 / 2,
},
}
Loading

0 comments on commit 18e353a

Please sign in to comment.