2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.hdpowerview.internal.dto;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.core.library.types.HSBType;
19 * Color and brightness information for HD PowerView repeater
21 * @author Jacob Laursen - Initial contribution
25 public int brightness;
30 public Color(int brightness, HSBType hsbType) {
31 this.brightness = brightness;
32 int rgb = hsbType.getRGB();
33 java.awt.Color color = new java.awt.Color(rgb);
35 green = color.getGreen();
36 blue = color.getBlue();
39 public Color(int brightness, java.awt.Color color) {
40 this.brightness = brightness;
42 green = color.getGreen();
43 blue = color.getBlue();
46 public Color(int brightness, int red, int green, int blue) {
47 this.brightness = brightness;
54 public String toString() {
55 return String.format("%d.%d.%d/%d%%", red, green, blue, brightness);