Skip to content

Commit

Permalink
fixes default shades
Browse files Browse the repository at this point in the history
  • Loading branch information
CarelessCourage committed Jan 5, 2024
1 parent 79f51b7 commit 16729f9
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/core/engine/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { UmbraScheme, UmbraSettings } from './types'
export const defaultSettings: UmbraSettings = {
readability: 10,
iterations: 15,
shades: [5, 10, 10, 10, 25, 25, 25, 25, 45, 45, 45, 45],
shades: [5, 5, 5, 5, 15, 10, 10, 25, 30, 25, 25, 25],
tints: [5, 10, 10, 10, 15, 15, 25, 15, 15, 15, 15, 25]
}

Expand Down
6 changes: 5 additions & 1 deletion packages/core/engine/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { colord, Colord } from 'colord'
import { UmbraAdjusted, UmbraInput } from './types'
import { pickContrast, colorMix } from './primitives/color'
import { normalizeRange, nextAccent, getStrings } from './primitives/utils'
import { defaultSettings } from './defaults'

interface GetRange {
from: Colord
Expand Down Expand Up @@ -32,10 +33,13 @@ function getRange({ from, to, range }: GetRange) {
function accentRange(
input: UmbraInput,
adjusted: UmbraAdjusted,
range: (number | string)[],
passedRange: (number | string)[],
color?: string
) {
const { background, foreground } = adjusted
const settingsRange = background.isDark() ? defaultSettings.shades : defaultSettings.tints
const range = passedRange.length > 0 ? passedRange : settingsRange || []

if (!color) return getRange({ from: background, to: foreground, range })

const defaultRange = input.settings.shades || []
Expand Down
2 changes: 0 additions & 2 deletions packages/core/engine/primitives/attach.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ function makeThemeSheet(
colors: FlattenColor[],
{ selector = ':root', meta = '1', marker = 'theme' }: MTS
) {
console.log('makeThemeSheet', colors, { selector, meta, marker })

const sheet = new CSSStyleSheet()
sheet.replace(
`${marker}-${meta}, ${selector} {${colors
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@umbrajs/core",
"version": "0.0.3333",
"version": "0.0.4",
"description": "Umbra is a theme managment library that allows you to create semantic color themes that are easy to dynamically customize, change retroactively and scale progressively",
"author": "Samuel M. Bednarz<https://github.com/CarelessCourage>",
"repository": {
Expand Down
24 changes: 22 additions & 2 deletions packages/playground/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,34 @@ const something = {
}
const accent = {
shades: [10, 10, 25, 25, 25, 25, 25, 25, '#ff0157', 10, 25, 25]
}
const accent2 = {
color: '#ff0157',
shades: [25, 25, 25, 45, 25, 25, 25, 25, 25, 25, 25, 25]
shades: [10, 10, 25, 25, 25, 25, 25, 25, 25, 10, 25, 25]
}
const accent3 = {
color: '#e5484d'
}
const theme = umbra({
background: '#000000',
foreground: '#ffffff',
accents: [radixBlue, radixRed, radixYellow, success, royal, brown, something, accent]
accents: [
radixRed,
radixYellow,
radixBlue,
accent,
accent2,
accent3,
radixRed,
success,
royal,
brown,
something
]
}).apply('body', {
alias: true
})
Expand Down

0 comments on commit 16729f9

Please sign in to comment.