Skip to content

Commit

Permalink
Update Accent interface and types
Browse files Browse the repository at this point in the history
  • Loading branch information
CarelessCourage committed Sep 10, 2024
1 parent f1136a9 commit 786353c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions packages/core/engine/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function replaceAtIndex(array: (number | string)[], index: number, value: string
return newArray
}

function putAccentInRange(adjusted: UmbraAdjusted, accent: Partial<Accent> | string, input: UmbraScheme) {
function putAccentInRange(adjusted: UmbraAdjusted, accent: Accent | string, input: UmbraScheme) {
const isString = typeof accent === 'string'
const color = isString ? accent : accent.color
const insertion = input.settings?.insertion
Expand All @@ -74,7 +74,7 @@ function putAccentInRange(adjusted: UmbraAdjusted, accent: Partial<Accent> | str
function accents(input: UmbraScheme, adjusted: UmbraAdjusted) {
const { background, foreground } = adjusted

function gen(accent: string | Partial<Accent>) {
function gen(accent: string | Accent) {
const isString = typeof accent === 'string'

const name = isString ? undefined : accent.name
Expand Down
11 changes: 6 additions & 5 deletions packages/core/engine/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ export interface UmbraOutput {
}

export interface Accent {
name: string
name?: string
color: string
shades: (number | string)[]
readability: number
shades?: (number | string)[]
tints?: (number | string)[]
readability?: number
}

export type UmbraInput = Partial<UmbraScheme>
Expand All @@ -39,13 +40,13 @@ export interface UmbraScheme extends UmbraColors {
export interface UmbraColors {
background: string
foreground: string
accents: string | (string | Partial<Accent>)[]
accents: string | (string | Accent)[]
}

export interface UmbraAdjusted {
background: Colord
foreground: Colord
accents: (string | Partial<Accent>)[]
accents: (string | Accent)[]
}

export interface UmbraSettings {
Expand Down
2 changes: 2 additions & 0 deletions packages/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type { FlattenColor, Formater, UmbraOutputs } from './engine/primitives/f
import { attach } from './engine/primitives/attach'
import { mostReadable, getReadability, colorMix } from './engine/primitives/color'
import type {
Accent,
UmbraScheme,
UmbraInput,
UmbraOutput,
Expand Down Expand Up @@ -35,6 +36,7 @@ export {
}

export type {
Accent,
Umbra,
UmbraScheme,
UmbraSettings,
Expand Down
5 changes: 3 additions & 2 deletions packages/nobel/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@ import ButtonGroup from './components/ui/Button/ButtonGroup.vue'
import TextScreen from './components/TextScreen.vue'
import { umbra } from '@umbrajs/core'
import type { Accent } from '@umbrajs/core'
const route = useRoute()
const inversed = ref(true)
const warningAccent = {
const warningAccent: Accent = {
name: 'warning',
color: '#ff0000'
}
const successAccent = {
const successAccent: Accent = {
name: 'success',
color: '#00ff00'
}
Expand Down

0 comments on commit 786353c

Please sign in to comment.