Skip to content

Commit 431072a

Browse files
committed
fix: unknown bug in this unused method?
1 parent 386d32f commit 431072a

2 files changed

Lines changed: 30 additions & 31 deletions

File tree

components/Thumb.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<script setup>
22
import { computed } from 'vue'
3-
//import { resolveColor } from '../layoutHelper'
43
const props = defineProps({
54
color: {
65
type: String,

layoutHelper.ts

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
11
import type { CSSProperties } from 'vue'
2-
import { colors } from '@unocss/preset-mini'
2+
// import { colors } from '@unocss/preset-mini'
33

4-
export function resolveColor(colorName: string, defaultColor: string = '#000000'): string {
5-
// If the input is already a hex code, return it
6-
if (/^#([0-9A-F]{3}){1,2}$/i.test(colorName)) {
7-
return colorName
8-
}
4+
// export function resolveColor(colorName: string, defaultColor: string = '#000000'): string {
5+
// // If the input is already a hex code, return it
6+
// if (/^#([0-9A-F]{3}){1,2}$/i.test(colorName)) {
7+
// return colorName
8+
// }
99

10-
// Split the color name into base and shade
11-
const [baseColor, shade] = colorName.toLowerCase().split('-')
10+
// // Split the color name into base and shade
11+
// const [baseColor, shade] = colorName.toLowerCase().split('-')
1212

13-
// Function to find the color in the colors object
14-
function findColor(obj: any, base: string, shade?: string): string | null {
15-
if (base in obj) {
16-
if (shade && typeof obj[base] === 'object' && shade in obj[base]) {
17-
return obj[base][shade]
18-
} else if (!shade && typeof obj[base] === 'string') {
19-
return obj[base]
20-
}
21-
}
13+
// // Function to find the color in the colors object
14+
// function findColor(obj: any, base: string, shade?: string): string | null {
15+
// if (base in obj) {
16+
// if (shade && typeof obj[base] === 'object' && shade in obj[base]) {
17+
// return obj[base][shade]
18+
// } else if (!shade && typeof obj[base] === 'string') {
19+
// return obj[base]
20+
// }
21+
// }
2222

23-
for (const value of Object.values(obj)) {
24-
if (typeof value === 'object' && value !== null) {
25-
const result = findColor(value, base, shade)
26-
if (result) return result
27-
}
28-
}
23+
// for (const value of Object.values(obj)) {
24+
// if (typeof value === 'object' && value !== null) {
25+
// const result = findColor(value, base, shade)
26+
// if (result) return result
27+
// }
28+
// }
2929

30-
return null
31-
}
30+
// return null
31+
// }
3232

33-
// Search for the color in the UnoCSS colors object
34-
const hexCode = findColor(colors, baseColor, shade)
33+
// // Search for the color in the UnoCSS colors object
34+
// const hexCode = findColor(colors, baseColor, shade)
3535

36-
// If a valid color is found, return its hex code; otherwise, return the default color
37-
return hexCode || defaultColor
38-
}
36+
// // If a valid color is found, return its hex code; otherwise, return the default color
37+
// return hexCode || defaultColor
38+
// }
3939

4040
/**
4141
* Resolve urls from frontmatter and append with the base url

0 commit comments

Comments
 (0)