Skip to content

Conversation

@Tatsu723
Copy link
Contributor

@Tatsu723 Tatsu723 commented Sep 5, 2025

  • markdown.tsxの変数componentsは関数の中に入れました。(コンポーネント呼び出しの都合上)

  • トグルのレンダリングとテーマ切り替えのための関数は1つのファイルにまとめました。

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Sep 5, 2025

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
my-code 2c05b76 Commit Preview URL

Branch Preview URL
Oct 03 2025, 07:26 AM

@na-trium-144
Copy link
Contributor

image ちょっと見づらいな? 具体的にどう色を変えたらいいかはパッとわからないけど、背景が明るすぎるのと、コードブロックの背景が黒すぎる+黒文字で読みづらいのがきになる

ちなみにテーマによって手動で色の指定を変更するのはこれの一番下にあるような書き方をするとできます
https://daisyui.com/docs/themes/

@Tatsu723
Copy link
Contributor Author

Tatsu723 commented Sep 8, 2025

コンフリクトの解消はこれで大丈夫でしょうか?
手間をかけてしまい申し訳ありません。

@Tatsu723
Copy link
Contributor Author

Tatsu723 commented Sep 9, 2025

syntaxhighlighterのstyleが(tomorrowやtwilightの一方で固定しても)反映されません。
それ以前にsyntaxhighlighterを消して試してみても全く変わらず、原因がずっと掴めません。

image

@na-trium-144
Copy link
Contributor

SyntaxHighlighterはmarkdown.tsx内に2カ所あるけど片方しか編集してないとか?
ページを再読み込みしてみるとか?

@Tatsu723
Copy link
Contributor Author

Tatsu723 commented Sep 9, 2025

試しに両方をtwilightに変更しているのですが、ページを再読み込みしても、色がずっと変わりません。
<Syntaxhighlighter...>...</Syntaxhighlighter>ごと消して、ページも再読み込みして試しましたが、それでもハイライト自体はされている?ような気がします。
↓Syntaxhighlighterを消した後
image

@Tatsu723
Copy link
Contributor Author

Tatsu723 commented Sep 9, 2025

ちなみにC++のページにあるコードブロックではtwilight適用できました。
(hydration failedしてますが…)
image

なので、
pythonのターミナルだけスタイルが他のスタイルと競合して上書きされてしまっている or pythonのターミナルがsyntaxhighlighterとは無関係に動いている
のどちらかかな?と考えています。

@na-trium-144
Copy link
Contributor

na-trium-144 commented Sep 10, 2025

ああ、はい pythonのターミナルはsyntaxhighlighterではないです
そちらはxterm.jsを使っていて、terminal/terminal.tsxに本体があります

useEffectの中で初期化時のテーマを設定しているんですけど、途中でテーマを変更する方法があるんじゃないかな?
useEffectをもう1つ追加して、daisyuiのテーマが切り替わったときにxterm.jsのテーマをそれにあわせて再設定する処理を書けばいいのかなと思っています

@Tatsu723
Copy link
Contributor Author

僕が物凄く勘違いをしていたようです。ご指摘ありがとうございました。
とりあえず、エディタやターミナル、コードブロックのテーマチェンジを全て修正しました。
後は残りの部分(トグルの位置調整等)を行って順次コミットします。

@Tatsu723
Copy link
Contributor Author

スマホ画面用のthemetoggleとの同期及びコード内の色の手動設定以外を実装しました。(これらの部分についてはこれから行います。)

@Tatsu723
Copy link
Contributor Author

Tatsu723 commented Oct 1, 2025

直近2つのコミットについて、

  1. ダークテーマの時のチャットバブルのbg:neutral、text:white、strong:secondaryにしました。
  2. themetoggleの連動は、useeffectの追加ではなく、MutationObserverで行いました。

Copy link
Contributor

@na-trium-144 na-trium-144 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

色についてはあとで考え直すとして、一旦これだけ直したらそろそろマージしましょう

"chat-bubble",
{ "bg-primary text-primary-content": msg.sender === 'user' },
{ "bg-secondary-content text-black": msg.sender === 'ai' && !msg.isError },
{ "bg-secondary-content dark:bg-neutral text-black dark:text-white": msg.sender === 'ai' && !msg.isError },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

text-neutral-content か text-base-content (daisyuiの色) にしておけばlightモードでは黒、darkモードでは白になるんじゃないかな
(daisyuiのドキュメントの右上のボタンからテーマを変更するとテーマごとの色を確認できる)

ダークモードで文字を完全な白にするのはコントラストが強すぎるので普通は少しグレーにするのがいいらしいです(ダークモードユーザーじゃないのでしらんけど)

import { ExecFile, ExecLang } from "../terminal/exec";
import { tomorrow } from "react-syntax-highlighter/dist/esm/styles/hljs";
import { useChangeTheme } from "./themeToggle";
import { tomorrow, atomOneDark } from "react-syntax-highlighter/dist/esm/styles/hljs";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

twilightなかった?

まあ別にatomOneDarkでも良いんだけど

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prism系の方ならありました。hljsだと見当たらないような気がします。

a: ({ node, ...props }) => <a className="link link-info" {...props} />,
strong: ({ node, ...props }) => (
<strong className="text-primary" {...props} />
<strong className="text-primary dark:text-secondary" {...props} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここに書くとaiの吹き出し以外でも色が変わってしまうのでは…

```python-exec:main.py
code: ({ node, className, ref, style, ...props }) => <CodeComponent {...{ node, className, ref, style, ...props }} />,
};
function CodeComponent({ node, className, ref, style, ...props }: { node: unknown; className?: string; ref?: unknown; style?: unknown; [key: string]: unknown }) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

型指定が汚い 🤔 (別issueにする)

@Tatsu723 Tatsu723 merged commit 0acc349 into main Oct 3, 2025
3 checks passed
@Tatsu723 Tatsu723 deleted the changetheme branch October 3, 2025 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants