This commit is contained in:
朱子楚\zhuzi
2023-10-03 16:18:53 +08:00
parent a6e494d1c7
commit 33fda1d025
13 changed files with 2335 additions and 22 deletions

View File

@ -197,23 +197,14 @@ Rectangle {
}
function _hsla(h, s, b, a) {
if(!enableAlphaChannel){
a = 1
}
var lightness = (2 - s)*b
var satHSL = s*b/((lightness <= 1) ? lightness : 2 - lightness)
lightness /= 2
var c = Qt.hsla(h, satHSL, lightness, a)
colorChanged(c)
return c
}
function _rgb(rgb, a) {
var c = Qt.rgba(rgb.r, rgb.g, rgb.b, a)
colorChanged(c)
return c
}

View File

@ -11,6 +11,7 @@ Button{
implicitWidth: width
implicitHeight: height
property alias colorValue: container.colorValue
property alias enableAlphaChannel: container.enableAlphaChannel
background:
Rectangle{
id:layout_color
@ -27,7 +28,7 @@ Button{
anchors.fill: parent
anchors.margins: 4
radius: 5
color: container.colorValue
color: control.colorValue
}
}

View File

@ -6,6 +6,7 @@ import "ColorPicker"
Item {
id:control
property alias colorValue: color_picker.colorValue
property alias enableAlphaChannel: color_picker.enableAlphaChannel
property int radius: 5
width: color_picker.width+10
height: color_picker.height