Skip to content

enhancement: dynamic theme-color meta tag from theme brand color#13509

Merged
LukasHirt merged 2 commits intoowncloud:masterfrom
priyanshuharshbodhi1:enhancement/dynamic-theme-color
Jan 22, 2026
Merged

enhancement: dynamic theme-color meta tag from theme brand color#13509
LukasHirt merged 2 commits intoowncloud:masterfrom
priyanshuharshbodhi1:enhancement/dynamic-theme-color

Conversation

@priyanshuharshbodhi1
Copy link
Contributor

Description

Dynamic theme-color meta tag using the brand color from the loaded theme via getComputedStyle().

Related Issue

Motivation and Context

Safari uses <meta name="theme-color"> to style the tab bar. The hardcoded value didn't match custom themes.

How Has This Been Tested?

  • test environment: Local dev server, Safari macOS
  • test case 1: Verified meta tag contains resolved hex color (not CSS variable)
  • test case 2: Inspected <head> to confirm theme-color meta tag is present

Types of changes

  • New feature (non-breaking change which adds functionality)

@update-docs
Copy link

update-docs bot commented Jan 21, 2026

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@CLAassistant
Copy link

CLAassistant commented Jan 21, 2026

CLA assistant check
All committers have signed the CLA.

@priyanshuharshbodhi1
Copy link
Contributor Author

@LukasHirt PTAL!


// Get brand color from CSS variable set by theme
const themeColor = ref('#375f7E')
onMounted(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Using this hook will not respect switching theme in the account settings.

// Get brand color from CSS variable set by theme
const themeColor = ref('#375f7E')
onMounted(() => {
const brandColor = getComputedStyle(document.documentElement)
Copy link
Collaborator

@LukasHirt LukasHirt Jan 22, 2026

Choose a reason for hiding this comment

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

Why use this instead of

const themeColor = computed(
  () => currentTheme.value.designTokens.colorPalette['swatch-brand-default']
)

This would give you the exact value of the theme color and you do not need to do the getComputedStyle.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great suggestion, switched to using computed() with the theme store directly.

- Switch from onMounted + getComputedStyle to computed() with theme store
- Theme-color now updates reactively when user switches themes
@priyanshuharshbodhi1
Copy link
Contributor Author

@LukasHirt PTAL!

@sonarqubecloud
Copy link

Copy link
Collaborator

@LukasHirt LukasHirt left a comment

Choose a reason for hiding this comment

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

Awesome, thank you! Tested on macos v26.2.

@LukasHirt LukasHirt enabled auto-merge January 22, 2026 11:27
@LukasHirt
Copy link
Collaborator

@priyanshuharshbodhi1 before we can merge this PR, the license needs to be signed. You can do so via the CLA assistant in this PR.

@LukasHirt LukasHirt merged commit 5f174f2 into owncloud:master Jan 22, 2026
4 checks passed
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.

Set meta prop "theme-color"

3 participants