mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-22 16:36:30 +00:00
Use Woodpecker theme colors on Safari Tab Bar / Header Bar (#632)
Add theme-color <meta> tag and dynamically change the theme-color when switching into / out of dark mode. It use the same colours as in the nav-bar component, but I don't think it's possible to access the Windi CSS colour definitions, so I had to hard core the hex values. The theme-colour <meta> tag needs to be present in the HTML, otherwise `querySelector` returns null.
This commit is contained in:
parent
0aefdc9978
commit
d0da1a104e
2 changed files with 3 additions and 0 deletions
|
@ -5,6 +5,7 @@
|
|||
<link rel="alternate icon" type="image/png" href="/favicons/favicon-light-default.png" id="favicon-png" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicons/favicon-light-default.svg" id="favicon-svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="theme-color" content="#65a30d" />
|
||||
<title>Woodpecker</title>
|
||||
<script type="" src="/web-config.js"></script>
|
||||
</head>
|
||||
|
|
|
@ -7,9 +7,11 @@ watch(isDarkModeActive, (isActive) => {
|
|||
if (isActive) {
|
||||
document.documentElement.classList.remove('light');
|
||||
document.documentElement.classList.add('dark');
|
||||
document.querySelector('meta[name=theme-color]')?.setAttribute('content', '#2e323e'); // dark-gray-900 (see windi.config.ts)
|
||||
} else {
|
||||
document.documentElement.classList.remove('dark');
|
||||
document.documentElement.classList.add('light');
|
||||
document.querySelector('meta[name=theme-color]')?.setAttribute('content', '#65a30d'); // lime-600
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue