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.boschshc.internal.services.hsbcoloractuator.dto;
15 import java.awt.Color;
17 import org.openhab.binding.boschshc.internal.services.dto.BoschSHCServiceState;
18 import org.openhab.core.library.types.HSBType;
21 * State representing colors of light bulbs.
23 * @author David Pace - Initial contribution
26 public class HSBColorActuatorServiceState extends BoschSHCServiceState {
28 public HSBColorActuatorServiceState() {
33 * RGB value modeled as an sRGB integer value (bits 24-31 are alpha, 16-23 are red, 8-15 are green, 0-7 are blue).
34 * Alpha is set to the fixed value <code>255</code>.
40 public ColorTemperatureRange colorTemperatureRange;
43 * Converts the combined {@link #rgb} value to an openHAB-compliant HSB state.
45 * @return color as {@link HSBType}
47 public HSBType toHSBType() {
48 Color color = new Color(rgb);
49 return HSBType.fromRGB(color.getRed(), color.getGreen(), color.getBlue());