Skip to content

Commit b2705ab

Browse files
authored
Create Workflow.php
1 parent a1c12c9 commit b2705ab

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/models/Workflow.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,4 +118,20 @@ public function beforeDelete()
118118
}
119119
return parent::beforeDelete();
120120
}
121+
122+
/**
123+
* @return string
124+
*/
125+
public function getColor()
126+
{
127+
$string = $this->id;
128+
$darker = 1.3;
129+
$rgb = substr(dechex(crc32(str_repeat($string, 10) . md5($string))), 0, 6);
130+
list($R16, $G16, $B16) = str_split($rgb, 2);
131+
$R = sprintf("%02X", floor(hexdec($R16) / $darker));
132+
$G = sprintf("%02X", floor(hexdec($G16) / $darker));
133+
$B = sprintf("%02X", floor(hexdec($B16) / $darker));
134+
return '#' . $R . $G . $B;
135+
}
136+
121137
}

0 commit comments

Comments
 (0)