Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit ef63027

Browse files
[[New Widget]] updated handlers that convert string to color and color to string handlers to ignore alpha component - opacity of all colors in the widget are fixed or set as property
1 parent a88705c commit ef63027

1 file changed

Lines changed: 6 additions & 13 deletions

File tree

extensions/widgets/pushbutton/pushbutton.lcb

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -434,24 +434,24 @@ end handler
434434

435435
private handler checkTextColor(in pTextColor as String) returns nothing
436436
if mWidgetTheme is "Android(Raised)" then
437-
if pTextColor is "255,255,255,255" then
437+
if pTextColor is "255,255,255" then
438438
put false into mShowBorder
439439
put mDefaultColor into mBackgroundColor
440440
else
441441
put true into mShowBorder
442442
put color [1,1,1] into mBackgroundColor
443443
end if
444444
else
445-
if pTextColor is "255,255,255,255" then
445+
if pTextColor is "255,255,255" then
446446
put mDefaultColor into mTextColor
447447
end if
448448
end if
449449
end handler
450450

451451
private handler checkBackgroundColor(in pBackgroundColor as String) returns nothing
452-
if pBackgroundColor is "255,255,255,255" then
452+
if pBackgroundColor is "255,255,255" then
453453
put true into mShowBorder
454-
if colorToString(mTextColor) is "255,255,255,255" then
454+
if colorToString(mTextColor) is "255,255,255" then
455455
put mDefaultColor into mTextColor
456456
end if
457457
else
@@ -487,13 +487,7 @@ private handler stringToColor(in pString as String) returns Color
487487
put (element 2 of tComponentList) parsed as number into tGreen
488488
put (element 3 of tComponentList) parsed as number into tBlue
489489

490-
if tComponentCount is 4 then
491-
put (element 4 of tComponentList) parsed as number into tAlpha
492-
else
493-
put 255 into tAlpha
494-
end if
495-
496-
return color [ tRed/255, tGreen/255, tBlue/255, tAlpha/255 ]
490+
return color [ tRed/255, tGreen/255, tBlue/255]
497491
end handler
498492

499493
-- this handler converts an RGBA color to a string of numbers
@@ -507,9 +501,8 @@ private handler colorToString(in pColor as Color) returns String
507501
put stripZeros((the rounded of ((the red of pColor) * 255)) formatted as string) into tRed
508502
put stripZeros((the rounded of ((the green of pColor) * 255)) formatted as string) into tGreen
509503
put stripZeros((the rounded of ((the blue of pColor) * 255)) formatted as string) into tBlue
510-
put stripZeros((the rounded of ((the alpha of pColor) * 255)) formatted as string) into tAlpha
511504

512-
return tRed & "," & tGreen & "," & tBlue & "," & tAlpha
505+
return tRed & "," & tGreen & "," & tBlue
513506
end handler
514507

515508
-- this handler strips the zeros when a integer is formatted as a string

0 commit comments

Comments
 (0)