mirror of
https://github.com/google/blockly.git
synced 2026-01-04 15:40:08 +01:00
Fix PHP's RGB colour block.
This commit is contained in:
@@ -58,6 +58,9 @@ Blockly.PHP['colour_rgb'] = function(block) {
|
||||
'colour_rgb',
|
||||
[ 'function ' + Blockly.PHP.FUNCTION_NAME_PLACEHOLDER_ +
|
||||
'($r, $g, $b) {',
|
||||
' $r = round(max(min($r, 100), 0) * 2.55);',
|
||||
' $g = round(max(min($g, 100), 0) * 2.55);',
|
||||
' $b = round(max(min($b, 100), 0) * 2.55);',
|
||||
' $hex = "#";',
|
||||
' $hex .= str_pad(dechex($r), 2, "0", STR_PAD_LEFT);',
|
||||
' $hex .= str_pad(dechex($g), 2, "0", STR_PAD_LEFT);',
|
||||
|
||||
Reference in New Issue
Block a user