unplugin / unplugin-turbo-console

🚀 Improve the Developer Experience of console
https://utc.yuy1n.io
MIT License
526 stars 12 forks source link

Highlight for console output in both light and dark styles #43

Closed normal-coder closed 3 months ago

normal-coder commented 4 months ago

Clear and concise description of the problem

The high-light colors output by Turbo Console are the same between the light and dark mode. However, in reality, the colors in dark mode appear very glaring. Just like the content output by the App.vue color block. In dark mode, the colors are too bright, causing the white text to appear weak instead, visually creating uncomfortable stimulation.

Suggested solution

Alternative

Refer to the solution above

Additional context

image

Validations

yuyinws commented 4 months ago

The highlight code is generated on compile time, So it is difficult to automatically adapt to the system theme.

I prefer to provide an advanced option for users to customize the theme like this:

TurboConsole({
      themes: {
        highlight: {
          icon: '🚀',
          vue: {
            padding: '2px 5px',
            radius: '3px 0 0 3px',
            color: '#fff',
            background: '#335d92',
          },
          js: {
            // ...
          },
          ts: {
            // ...
          }
        },
        launchEditor: {
          icon: '🔦',
          style: {
            padding: '2px 5px',
            radius: '3px 0 0 3px',
            color: '#fff',
            background: '#335d92',
          }
        }
      }
})

WDYT?

normal-coder commented 4 months ago

The highlight code is generated on compile time, So it is difficult to automatically adapt to the system theme.

I prefer to provide an advanced option for users to customize the theme like this:

...

WDYT?

Providing various customization options is a good way. BTW, users also like the plug-and-play recommendation 😂

I tried it myself. Originally, I thought of using the Window object to determine if it is in dark mode, but obviously, this cannot be applied to all scenarios. Perhaps multiple methods can be considered for combination.

const isDarkTheme = window.matchMedia("(prefers-color-scheme: dark)");
yuyinws commented 3 months ago

This feature had release on v1.10.0.

You can refer documentation for the setup.