Skip to content

Commit

Permalink
nit
Browse files Browse the repository at this point in the history
  • Loading branch information
CarelessCourage committed Dec 30, 2023
1 parent d5ab910 commit 136ddc7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/core/engine/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ function umbraAdjust(settings: UmbraSettings, scheme = defaultScheme) {

export function umbraHydrate(input: UmbraInput, output: RawRange[]) {
const apply = ({ element, formater, alias }: ApplyProps = {}) =>
format({ output, formater }).attach(input, element, alias)
format({ output, formater, input }).attach(element, alias)
return {
apply,
input,
output,
isDark: () => isDark(input.scheme),
format: (formater?: Formater) => format({ output, formater }),
format: (formater?: Formater) => format({ input, output, formater }),
inverse: () => umbra(inverse(input).scheme, input.settings)
}
}
17 changes: 12 additions & 5 deletions packages/core/engine/primitives/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import { attach, Alias } from './attach'
export type Formater = (color: Colord) => string

interface FormatProps {
input: UmbraInput
output: RawRange[]
formater?: Formater
element?: HTMLElement
}

export interface Format extends UmbraOutputs {
attach: (input: UmbraInput, element?: HTMLElement, alias?: Alias | boolean) => UmbraOutputs
attach: (element?: HTMLElement, alias?: Alias | boolean) => UmbraOutputs
}

export interface UmbraOutputs {
Expand All @@ -21,7 +22,11 @@ export interface UmbraOutputs {
output: RawRange[]
}

export const format = ({ output = umbra().output, formater = defaultFormater }: FormatProps) => {
export const format = ({
input,
output = umbra().output,
formater = defaultFormater
}: FormatProps) => {
let existingAccents = 0
function getName(name: string) {
if (name !== 'accent') return name
Expand Down Expand Up @@ -52,9 +57,11 @@ export const format = ({ output = umbra().output, formater = defaultFormater }:
}

return {
attach: (input, element, alias) => attach({ input, outputs, element, alias }),
...outputs
} as Format
input,
...outputs,
attach: (element?: HTMLElement, alias?: Alias | boolean) =>
attach({ input, outputs, element, alias })
}
}

export const defaultFormater = hexFormat
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.332",
"version": "0.0.333",
"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

0 comments on commit 136ddc7

Please sign in to comment.