Skip to content

Commit

Permalink
Merge pull request #262 from vim-jp-radio/feature/fix-uno
Browse files Browse the repository at this point in the history
  • Loading branch information
ryoppippi authored Aug 14, 2024
2 parents f808682 + 44c659e commit c8ed1fd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
34 changes: 18 additions & 16 deletions uno.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,26 @@ import {
transformerVariantGroup,
} from 'unocss';

export const theme = {
colors: {
'LP-blue': '#1ecfff',
'LP-pink': '#ff00ff',
'LP-yellow': '#ffffb3',
'LP-gray': '#909296',
'LP-dark-gray': '#5C5F66',
'LP-backgroud': '#010a01',
'LP-text-color': '#f8f9fa',
},
breakpoints: {
tiny: '375px',
},
} as const;

export default defineConfig({
presets: [
presetUno(), // defaultの設定。
presetUno({
extendedTheme: theme, // `extendedTheme` を用いないと deep-merge されない https://github.com/unocss/unocss/issues/3038#issuecomment-2287766398
}),
presetAttributify({ prefix: 'uno-', prefixedOnly: true }), // class属性ではなく、属性地に直接書く設定。https://unocss.dev/presets/attributify
presetIcons({ autoInstall: isDevelopment }), // Iconを使うための設定。autoInstallも設定している。https://unocss.dev/presets/icons
],
Expand All @@ -25,21 +42,6 @@ export default defineConfig({
],
},
},
theme: {
colors: {
'LP-blue': '#1ecfff',
'LP-pink': '#ff00ff',
'LP-yellow': '#ffffb3',
'LP-gray': '#909296',
'LP-dark-gray': '#5C5F66',
'LP-backgroud': '#010a01',
'LP-text-color': '#f8f9fa',
},
breakpoints: {
...presetUno()?.theme?.breakpoints ?? {}, // https://github.com/unocss/unocss/issues/3038
tiny: '375px',
},
},
rules: [
['p-safe', { padding: 'env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)' }],
['min-h-safe', { 'min-height': 'calc(100% + env(safe-area-inset-top))' }],
Expand Down
6 changes: 2 additions & 4 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,15 @@ import extractorSvelte from '@unocss/extractor-svelte';
import { cloudflareRedirect } from '@ryoppippi/vite-plugin-cloudflare-redirect';
import { faviconPlugin } from './plugins';

import UnocssConfig from './uno.config.js';
import { theme } from './uno.config.js';
import { LINKS, VIM_JP_RADIO_INFO } from './src/lib/links/_links.js';

function relativePath(...args: string[]): string {
return path.resolve(import.meta.dirname, ...args);
}

/* unocss から background color を取得 */
// @ts-expect-error background color may be undefined
// eslint-disable-next-line ts/no-unsafe-member-access
const background = UnocssConfig?.theme?.colors?.['LP-backgroud'] as unknown;
const background = theme.colors['LP-backgroud'];

if (typeof background !== 'string') {
throw new TypeError('background color is not defined');
Expand Down

0 comments on commit c8ed1fd

Please sign in to comment.