Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[project-s] 鍵盤・シーケンサーのテーマ・ダークモード対応 #1755

Closed
y-chan opened this issue Jan 24, 2024 · 3 comments · Fixed by #1796
Closed

[project-s] 鍵盤・シーケンサーのテーマ・ダークモード対応 #1755

y-chan opened this issue Jan 24, 2024 · 3 comments · Fixed by #1796

Comments

@y-chan
Copy link
Member

y-chan commented Jan 24, 2024

内容

題の通りです。現状は色の値が直に書き込まれているなど、様々な原因でダークモード時の表示がおかしくなります。
間に合いそうならプロトタイプリリースに間に合わせられると良さそうです。

現状は以下のような感じになっています。

image

鍵盤・シーケンサーについては、他ソフト(Synthesizer V Studio)だとこんな感じなので、参考にできるとよさそう。
image
鍵盤は明度を下げる感じ、シーケンサーは明度の差があるグレーを使えばある程度良いんじゃないかなと。
$backgroundをうまく使ってあげると良いかもしれないです。

とりあえず現状のコードを調べてみた感じ、以下の色がありそうでした(見落としあるかもです)

Pros 良くなる点

表示が良くなる

Cons 悪くなる点

特になし

実現方法

テーマの色を増やして、反映する

@y-chan y-chan changed the title [project-s] 鍵盤・シーケンサーのダークモード対応 [project-s] 鍵盤・シーケンサーのテーマ・ダークモード対応 Jan 24, 2024
@romot-co
Copy link
Contributor

romot-co commented Jan 25, 2024

以下に対応させるとよさそうでしょうか…?
#1756

(色定義でシーケンサ特有の部分について追加いたします)

新規定義が必要そうな部分

  • ピアノ鍵盤部分のカラー: 白鍵 / 黒鍵
  • ピアノ鍵盤部分 / シーケンサグリッド: ボーダー1(罫線の濃い方...小節およびオクターブ)
  • ピアノ鍵盤部分 / シーケンサグリッド: ボーダー2(罫線の薄い方)
  • シーケンサグリッド: 黒鍵にあたるエリアのカラー
  • シーケンサグリッド: 白鍵にあたるエリアのカラー(いらないかも)
  • ノート: ボーダー
  • ノート: 選択中
  • ノート: 無効(重なったノート)
  • ノート: 入力時テキスト入力エリア

必要でなさそうなもの

  • テキストカラー: 標準
  • 警告: 標準

確認中

  • テキストカラー: Medium-emphasis
  • テキストカラー: Disabled

@y-chan
Copy link
Member Author

y-chan commented Jan 25, 2024

新デザインについては、後で適用していくことになると思うので、一旦気にしないで良いと思います...!

現在CSS上で直に設定している値はデフォルトテーマにそのまま使っていいと思うので、ひとまず新規定義が必要そうな部分で挙げられている色をこちらに追加してもらうことになりそうです。

https://github.com/VOICEVOX/voicevox/blob/main/public/themes/default.json

その後、ダークテーマの色をいい感じに決めて以下に追加してもらえれば...!

https://github.com/VOICEVOX/voicevox/blob/main/public/themes/dark.json

以下の部分がいい感じに可変色を反映してくれているので

SET_THEME_SETTING: {
mutation(
state,
{ currentTheme, themes }: { currentTheme: string; themes?: ThemeConf[] }
) {
if (themes) {
state.themeSetting.availableThemes = themes;
}
state.themeSetting.currentTheme = currentTheme;
},
action({ state, commit }, { currentTheme }: { currentTheme: string }) {
window.electron.theme(currentTheme);
const theme = state.themeSetting.availableThemes.find((value) => {
return value.name == currentTheme;
});
if (theme == undefined) {
throw Error("Theme not found");
}
for (const key in theme.colors) {
const color = theme.colors[key as ThemeColorType];
const { r, g, b } = colors.hexToRgb(color);
document.documentElement.style.setProperty(`--color-${key}`, color);
document.documentElement.style.setProperty(
`--color-${key}-rgb`,
`${r}, ${g}, ${b}`
);
}
const mixColors: ThemeColorType[][] = [
["primary", "background"],
["warning", "background"],
];
for (const [color1, color2] of mixColors) {
const color1Rgb = colors.hexToRgb(theme.colors[color1]);
const color2Rgb = colors.hexToRgb(theme.colors[color2]);
const r = Math.trunc((color1Rgb.r + color2Rgb.r) / 2);
const g = Math.trunc((color1Rgb.g + color2Rgb.g) / 2);
const b = Math.trunc((color1Rgb.b + color2Rgb.b) / 2);
const propertyName = `--color-mix-${color1}-${color2}-rgb`;
const cssColor = `${r}, ${g}, ${b}`;
document.documentElement.style.setProperty(propertyName, cssColor);
}
Dark.set(theme.isDark);
setCssVar("primary", theme.colors["primary"]);
setCssVar("warning", theme.colors["warning"]);
document.documentElement.setAttribute(
"is-dark-theme",
theme.isDark ? "true" : "false"
);
window.electron.setNativeTheme(theme.isDark ? "dark" : "light");
commit("SET_THEME_SETTING", {
currentTheme: currentTheme,
});
},
},

それを元に更にSCSSに書き込んで、使ってあげればとりあえずこのIssueは完了になるのかなと...!

https://github.com/VOICEVOX/voicevox/blob/main/src/styles/colors.scss

@romot-co
Copy link
Contributor

@y-chan
ありがとうございます!こちら調整・修正いたします!

romot-co pushed a commit that referenced this issue Jan 30, 2024
romot-co pushed a commit that referenced this issue Jan 30, 2024
romot-co pushed a commit that referenced this issue Jan 30, 2024
Hiroshiba pushed a commit that referenced this issue Jan 31, 2024
* #1755 ダークモード対応(初期調整)

* #1755 表示調整

* #1755 オクターブ表示の変更

* #1755 スナップと拍で色を変える

---------

Co-authored-by: Romot <romot@romotmbp16.local>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants