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

fix(VColorPicker): consistent output values #16674

Merged
merged 4 commits into from
Feb 21, 2023

Conversation

KaelWD
Copy link
Member

@KaelWD KaelWD commented Feb 15, 2023

Description

Fixes #16672

  • hex now parses with or without leading #
  • alpha value is removed instead of resetting to FF

Markup:

<template>
  <v-app>
    <v-main>
      <v-container>
        <v-color-picker
          v-model="pickedColor"
          elevation="15"
          mode="rgba"
          :modes="['hex', 'hexa', 'rgb', 'rgba']"
        />
        <div class="mt-3">
          Selected color: {{ pickedColor }}
        </div>
      </v-container>
    </v-main>
  </v-app>
</template>

<script setup>
  import { ref } from 'vue'

  const pickedColor = ref('#00FF00')
</script>

@KaelWD KaelWD added T: bug Functionality that does not work as intended/expected C: VColorPicker labels Feb 15, 2023
@KaelWD KaelWD added this to the v3.1.x milestone Feb 15, 2023
@KaelWD KaelWD requested a review from nekosaur February 15, 2023 12:31
@KaelWD KaelWD self-assigned this Feb 15, 2023
@nekosaur
Copy link
Member

Hah, I was fixing #16689 and noticed these issues. I hadn't seen your PR. Here's mine master...fix/color-picker-stuff. Your changes look good, and I feel like you probably have a better grasp of the color utils. You might want to bring over my tests though.

@KaelWD
Copy link
Member Author

KaelWD commented Feb 17, 2023

Pretty similar solutions.

  • I think your getValue changes are redundant, I just skip calling it if there's no color.
  • I removed alpha rounding because it was skipping some values
  • My hex changes handle short values (#rgb, #rgba) with or without #, and remove alpha if it's FF. It does also remove a from objects though which I'm not super stoked about

Copy link
Member

@johnleider johnleider left a comment

Choose a reason for hiding this comment

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

Much better experience, gj.

@KaelWD KaelWD merged commit 01c35ef into master Feb 21, 2023
@KaelWD KaelWD deleted the fix/16672-color-picker-hexa-nan branch February 21, 2023 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VColorPicker T: bug Functionality that does not work as intended/expected
Projects
None yet
3 participants