Skip to content

Commit

Permalink
hsv100to360
Browse files Browse the repository at this point in the history
  • Loading branch information
djdizzyd committed Jul 19, 2020
1 parent a47362e commit e8de1cc
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions Apps/hsv100to360.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,23 @@ preferences {
def mainPage() {
dynamicPage(name: "mainPage", title: "Hubitat HSV100 Colors", stall: true, uninstall: true) {
section {
String table = "<table border=1><tr><th>Hue<br/>360</th><th>Hue<br/>100</th><th>Color<br/>Hex</th></tr>"
for (int i in 0..100) {
List hsv100 = [i,100,100]
String table = "<table border=1><tr><th>Hue<br/>360</th><th>Hue<br/>100</th><th>Color<br/>Hex</th>"
for (int i in (95..0).step(5)) {
table += "<th>sat<br/>${i}</th>"
}
table +="</tr>"
for (int h in 0..100) {
List hsv100 = [h,100,100]
List rgbColor = hubitat.helper.ColorUtils.hsvToRGB(hsv100)
List hsv360 = hubitat.helper.ColorUtils.rgbToHSV360(rgbColor)
String rgbHex = hubitat.helper.ColorUtils.rgbToHEX(rgbColor)
if (i==100) hsv360[0]=360
table += "<tr><td>${Math.round(hsv360[0])}</td><td>${i}</td><td bgcolor='${rgbHex}'>${rgbHex}</td></tr>"
if (h==100) hsv360[0]=360
table += "<tr><td>${Math.round(hsv360[0])}</td><td>${h}</td><td bgcolor='${rgbHex}'>${rgbHex}</td>"
for (int s in (95..0).step(5)) {
String rgbColorSat = hubitat.helper.ColorUtils.rgbToHEX(hubitat.helper.ColorUtils.hsvToRGB([h,s,100]))
table += "<td bgcolor='${rgbColorSat}'></td>"
}
table += "</tr>"
}
table += "</table>"
paragraph table
Expand Down

0 comments on commit e8de1cc

Please sign in to comment.