Skip to content

Commit

Permalink
composableを使用 [update snapshots]
Browse files Browse the repository at this point in the history
  • Loading branch information
Romot authored and Romot committed Jul 18, 2024
1 parent 84d5fb7 commit 4b7488b
Show file tree
Hide file tree
Showing 14 changed files with 428 additions and 474 deletions.
2 changes: 1 addition & 1 deletion public/color-schemes/default.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"label": "デフォルト",
"name": "デフォルト",
"sourceColor": "#A5D4AD",
"variant": "tonalSpot",
"contrastLevel": 0.0,
Expand Down
2 changes: 1 addition & 1 deletion public/color-schemes/monochrome.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"label": "モノクローム",
"name": "モノクローム",
"sourceColor": "#A5D4AD",
"variant": "monochrome",
"isDark": false,
Expand Down
2 changes: 1 addition & 1 deletion public/color-schemes/none.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"label": "調整なし(M3デフォルト)",
"name": "調整なし(M3デフォルト)",
"sourceColor": "#A5D4AD",
"variant": "content",
"contrastLevel": 0.0,
Expand Down
24 changes: 12 additions & 12 deletions public/color-schemes/test.json → public/color-schemes/spring.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"label": "テスト",
"name": "スプリング",
"sourceColor": "#9cf476",
"variant": "content",
"contrastLevel": 0,
"adjustments": {
"neutral": {
"chroma": 3.7
"chroma": 0
},
"neutralVariant": {
"chroma": 24.4,
"chroma": 20.1,
"tone": 0
},
"tertiary": {
"hex": "#ff1a6a",
"chroma": 19.4,
"hex": "#ffae52",
"chroma": 70,
"tone": 80
},
"error": {
Expand Down Expand Up @@ -54,7 +54,7 @@
},
{
"name": "sing-ruler-measure-line",
"palette": "secondary",
"palette": "tertiary",
"lightTone": 80,
"darkTone": 70,
"blend": true
Expand Down Expand Up @@ -82,7 +82,7 @@
},
{
"name": "sing-grid-measure-line",
"palette": "secondary",
"palette": "tertiary",
"lightTone": 80,
"darkTone": 40,
"blend": true
Expand All @@ -103,9 +103,9 @@
},
{
"name": "sing-piano-key-black",
"palette": "tertiary",
"lightTone": 83,
"darkTone": 15,
"palette": "neutral",
"lightTone": 65,
"darkTone": 20,
"blend": true
},
{
Expand All @@ -124,9 +124,9 @@
},
{
"name": "sing-toolbar-container",
"palette": "neutral",
"palette": "neutralVariant",
"lightTone": 100,
"darkTone": 20,
"darkTone": 25,
"blend": true
}
],
Expand Down
9 changes: 6 additions & 3 deletions src/backend/browser/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
HotkeySettingType,
Sandbox,
ThemeConf,
ColorSchemeConfig,
} from "@/type/preload";
import {
ContactTextFileName,
Expand Down Expand Up @@ -315,10 +316,12 @@ export const api: Sandbox = {
// ブラウザ版では、ファイルシステムから直接読み込むのではなく、
// ビルド時に生成されたファイルを読み込む
// NOTE: 定数にする?
const colorSchemeFiles = ["default.json"];
const colorSchemeFiles = ["default.json", "none.json", "monochrome.json"];

// カラースキーム個別の取得
const fetchColorScheme = async (fileName: string) => {
const fetchColorScheme = async (
fileName: string,
): Promise<ColorSchemeConfig> => {
const response = await fetch(`/color-schemes/${fileName}`);
if (!response.ok) {
throw new Error(`Failed to load color scheme: ${fileName}`);
Expand All @@ -329,7 +332,7 @@ export const api: Sandbox = {
// すべてのカラースキームの取得
return Promise.all(colorSchemeFiles.map(fetchColorScheme))
.then((colorSchemes) => {
return colorSchemes;
return colorSchemes as ColorSchemeConfig[];
})
.catch((error) => {
throw new Error(`Error loading color schemes: ${error}`);
Expand Down
Loading

0 comments on commit 4b7488b

Please sign in to comment.