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

[Bug Report][3.6.8] Custom colors transparency/opacity is ignored #19961

Open
simionato-mobisec opened this issue Jun 6, 2024 · 1 comment
Open

Comments

@simionato-mobisec
Copy link

Environment

Vuetify Version: 3.6.8
Vue Version: 3.4.27
Browsers: Firefox 126.0
OS: Ubuntu undefined

Steps to reproduce

  1. Create a custom theme.
  2. Create a color named "test" with a value of "#ff000014".
  3. Change VTextField defaults and set its color prop to "test".

Expected Behavior

The focused text field should have a transparent red color.

Actual Behavior

The focused text field has a red color, transparency is ignored.

Reproduction Link

https://play.vuetifyjs.com/#...

@walter-0
Copy link

Haven't confirmed yet, but I think this line is the culprit:

https://github.com/vuetifyjs/vuetify/blob/master/packages/vuetify/src/composables/theme.ts#L418

function genCssVariables (theme: InternalThemeDefinition) {
// ...
  for (const [key, value] of Object.entries(theme.colors)) {
    const rgb = parseColor(value)
    variables.push(`--v-theme-${key}: ${rgb.r},${rgb.g},${rgb.b}`) // this line is not using the 
    if (!key.startsWith('on-')) {
      variables.push(`--v-theme-${key}-overlay-multiplier: ${getLuma(value) > 0.18 ? lightOverlay : darkOverlay}`)
    }
  }
// ...
}

From doing a little bit of testing, parseColor() calls HexToRGB() which appears to be correctly converting to rgba but the value rgb.a is not being used in the string.

Should L418 be updated to this?

variables.push(`--v-theme-${key}: ${rgb.r},${rgb.g},${rgb.b},${rgb.a}`)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants