generate(options)
获取基础色对应的调色板,可以直接获取10个色阶的调色板集合
options
参数名称 | 类型 | 必填 | 可选值 | 默认值 | 描述 |
---|---|---|---|---|---|
color | string | 是 | - | #604cfc | 基础色,只支持hex值 |
mode | string | 否 | light:浅色 dark:暗色 | light | 暗黑模式 |
基础使用
vue
<script setup>
import { generate } from "@/uni_modules/ucs-color";
// [Array]
// ["#EFE8FF", "#D6C9FE", "#BCA9FE", "#9F8AFD", "#816BFD", "#604cfc", "#3C2FD0", "#2019A4", "#0B0978", "#00014D"]
console.log(generate("#604cfc"))
</script>
浅色系与暗色系
vue
<script setup>
import { generate } from "@/uni_modules/ucs-color";
// 浅色系
// ["#EFE8FF", "#D6C9FE", "#BCA9FE", "#9F8AFD", "#816BFD", "#604cfc", "#3C2FD0", "#2019A4", "#0B0978", "#00014D"]
console.log(generate("#604cfc","light"))
// 暗色系
// ["#00014D", "#080678", "#2019A4", "#4134D0", "#6B59FC", "#8772FD", "#A491FD", "#C1B0FE", "#DACEFE", "#F3EEFF"]
console.log(generate("#604cfc","dark"))
</script>