Skip to content

Commit

Permalink
Fixes issues with types for named accents
Browse files Browse the repository at this point in the history
  • Loading branch information
CarelessCourage committed Sep 10, 2024
1 parent 294f9da commit b8f919f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
12 changes: 11 additions & 1 deletion packages/core/engine/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,20 @@ export const defaultSettings: UmbraSettings = {
tints: [5, 10, 10, 10, 15, 15, 25, 15, 15, 15, 15, 25]
}

const warningAccent = {
name: 'warning',
color: '#ff0000'
}

const successAccent = {
name: 'success',
color: '#00ff00'
}

export const defaultScheme: UmbraScheme = {
background: '#090233',
foreground: '#ff5555',
accents: ['#5200ff'],
accents: ["#ffffff", warningAccent, successAccent],
settings: defaultSettings,
inversed: {
background: '#ff5555',
Expand Down
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: Accent | string, input: UmbraScheme) {
function putAccentInRange(adjusted: UmbraAdjusted, accent: Partial<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: Accent | string, inpu
function accents(input: UmbraScheme, adjusted: UmbraAdjusted) {
const { background, foreground } = adjusted

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

const name = isString ? undefined : accent.name
Expand Down
4 changes: 2 additions & 2 deletions packages/core/engine/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ export interface UmbraScheme extends UmbraColors {
export interface UmbraColors {
background: string
foreground: string
accents: string | string[]
accents: string | (string | Partial<Accent>)[]
}

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

export interface UmbraSettings {
Expand Down
11 changes: 9 additions & 2 deletions packages/nobel/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<script setup lang="ts">
import { ref } from 'vue'
import { useRoute } from 'vue-router'
// ...
import IconHome from './components/Icons/IconHome.vue'
import IconWidth from './components/Icons/IconWidth.vue'
import IconPaint from './components/Icons/IconPaint.vue'
Expand All @@ -12,6 +16,9 @@ import TextScreen from './components/TextScreen.vue'
import { umbra } from '@umbrajs/core'
const route = useRoute()
const inversed = ref(true)
const warningAccent = {
Expand Down Expand Up @@ -40,7 +47,7 @@ function toggleTheme() {

<template>
<header>
<TextScreen>{{ $route.fullPath }}</TextScreen>
<TextScreen>{{ route.fullPath }}</TextScreen>
<nav>
<ButtonGroup>
<RouterLink to="/" class="button focus small" activeClass="primary">
Expand All @@ -66,7 +73,7 @@ function toggleTheme() {
</nav>
</header>
<main>
<router-view :key="$route.path"></router-view>
<router-view :key="route.path"></router-view>
</main>
</template>

Expand Down

0 comments on commit b8f919f

Please sign in to comment.