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

feat: added picker color component #417

Merged
merged 35 commits into from
Mar 18, 2024
Merged

Conversation

baiwusanyu-c
Copy link
Member

@baiwusanyu-c baiwusanyu-c commented Mar 18, 2024

close: #409

preview

image

demo

<script lang="ts">
  import { KColorPicker } from "@ikun-ui/color-picker";
  let value = "#1677FF"
  const handleChange = (e) => {
    console.log(e.detail)
    value = e.detail
  }

  let resolveValue = "#f8a153"
  const handleChangeComplete = (e) => {
    console.log(21)
    console.log(e.detail)
    resolveValue = e.detail
  }

  let hRValue = 0
  function handleInput(e: CustomEvent, type: 'hr' | 'sg' | 'vb' | 'a' | 'hex') {
    if (type === 'hr') {
      hRValue = e.detail;
    }
  }

  const presets = [
    {
      "label": "primary",
      "colors": [
        "#e6f4ff",
        "#bae0ff",
        "#91caff",
        "#69b1ff",
        "#4096ff",
        "#1677ff",
        "#0958d9",
        "#003eb3",
        "#002c8c",
        "#001d66",
      ]
    },
    {
      "label": "red",
      "colors": [
        "#fff1f0",
        "#ffccc7",
        "#ffa39e",
        "#ff7875",
        "#ff4d4f",
        "#f5222d",
        "#cf1322",
        "#a8071a",
        "#820014",
        "#5c0011"
      ],
      defaultOpen:true
    },
    {
      "label": "green",
      "colors": [
        "#f6ffed",
        "#d9f7be",
        "#b7eb8f",
        "#95de64",
        "#73d13d",
        "#52c41a",
        "#389e0d",
        "#237804",
        "#135200",
        "#092b00"
      ]
    }
  ]
</script>

<KColorPicker defaultValue="#1677FF"
              {value}
              title="ikun color picker"
              size="sm"
              format="hsv"
              {presets}
              allowClear
              showText
              on:change={handleChange}
              on:changeComplete={handleChangeComplete}>
</KColorPicker>

<KColorPicker defaultValue="#1677FF"
              {value}
              title="ikun color picker"
              format="hsv"
              {presets}
              allowClear
              showText
              on:change={handleChange}
              on:changeComplete={handleChangeComplete}>
</KColorPicker>

<KColorPicker defaultValue="#1677FF"
              {value}
              title="ikun color picker"
              format="hsv"
              {presets}
              size="lg"
              allowClear
              showText
              on:change={handleChange}
              on:changeComplete={handleChangeComplete}>
</KColorPicker>

Copy link

netlify bot commented Mar 18, 2024

Deploy Preview for ikun-ui canceled.

Name Link
🔨 Latest commit 1940573
🔍 Latest deploy log https://app.netlify.com/sites/ikun-ui/deploys/65f8020fd1a9c2000874da88

@baiwusanyu-c baiwusanyu-c merged commit 7243da5 into main Mar 18, 2024
4 of 7 checks passed
@baiwusanyu-c baiwusanyu-c deleted the bwsy/feat/color-picker branch March 18, 2024 08:58
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.

[Feature Request] - KColorPicker
1 participant