async void ChangeBulbSettings(string bulbLabel, int hueShift, double brightness) { HueSatLight hsl = new HueSatLight(hueShift / 360.0, 1, 0.5); System.Diagnostics.Debug.WriteLine($"{hsl.AsHtml}"); await lifxService.ChangeBulbSettings(bulbLabel, hsl.AsHtml, brightness); }
private void SetColor(HueSatLight hueSatLight) { Color asRGB = hueSatLight.AsRGB; Dmx.Controller.SetChannel(ChannelStart, asRGB.R); Dmx.Controller.SetChannel(ChannelStart + 1, asRGB.G); Dmx.Controller.SetChannel(ChannelStart + 2, asRGB.B); }
public BasePropertyChanger GetPropertyChanger() { ChangeColor result = new ChangeColor(); HueSatLight hueSatLight = GetHsl(); float multiplier = trkMultiplier.Value / 10.0f; result.SetValue(hueSatLight.AsHtml, multiplier); return(result); }
private HueSatLight GetHsl() { HueSatLight hueSatLight = new HueSatLight(); hueSatLight.Hue = trkHue.Value / 100.0; hueSatLight.Saturation = trkSat.Value / 100.0; hueSatLight.Lightness = trkLight.Value / 100.0; return(hueSatLight); }
private static void CorrectHueShifts(DiceRoll diceRoll, HueSatLight hueSatLight) { foreach (TrailingEffect trailingEffect in diceRoll.TrailingEffects) { double hueOffset = 0; if (trailingEffect.Name == "FrostTrail") { hueOffset = 163; // FrostTrail raw color is blue - this shifts it back to red. } trailingEffect.HueShift = (360 * hueSatLight.Hue + hueOffset).ToString(); } }
void UpdateColor() { Hue = sldHue.Value; Saturation = sldSaturation.Value; Lightness = sldLightness.Value; HueSatLight hueSatLight = new HueSatLight(Hue / 360.0, Saturation / 100, Lightness / 100); rctSample.Fill = new SolidColorBrush(hueSatLight.AsRGB); tbHue.Text = Math.Round(sldHue.Value).ToString(); tbSaturation.Text = Math.Round(sldSaturation.Value).ToString(); tbLightness.Text = Math.Round(sldLightness.Value).ToString(); }
private void UpdateHtml() { changingTextInternally = true; try { HueSatLight hueSatLight = new HueSatLight(btnSetColor.BackColor); tbxHtml.Text = hueSatLight.AsHtml; } finally { changingTextInternally = false; } }
private void trkColor_Scroll(object sender, EventArgs e) { if (changingTrackbarsInternally) { Talespire.Log.Debug($"changingTrackbarsInternally is true"); return; } HueSatLight hueSatLight = GetHsl(); //Talespire.Log.Debug($"hueSatLight - hue = {hueSatLight.Hue}, saturation = {hueSatLight.Saturation}, lightness = {hueSatLight.Lightness} "); btnSetColor.BackColor = hueSatLight.AsRGB; ColorChanged(); UpdateHtml(); }
private void UpdateTrackbars() { changingTrackbarsInternally = true; try { HueSatLight hueSatLight = new HueSatLight(btnSetColor.BackColor); trkHue.Value = (int)(hueSatLight.Hue * 100); trkSat.Value = (int)(hueSatLight.Saturation * 100); trkLight.Value = (int)(hueSatLight.Lightness * 100); } finally { changingTrackbarsInternally = false; } }
static DiceRoll CreateRoll(string command, CardDto cardDto, DndViewer viewer) { string parameterStr = command.EverythingAfter("(").EverythingBeforeLast(")"); string[] parameters = parameterStr.Split(','); if (parameters.Length < 2) { return(null); } DiceRoll diceRoll = new DiceRoll(DiceRollType.ViewerRoll); diceRoll.AddTrailingEffects(viewer.TrailingEffects); HueSatLight hueSatLight = new HueSatLight(viewer.DieBackColor); CorrectHueShifts(diceRoll, hueSatLight); diceRoll.DieTotalMessage = $"{cardDto.Card.UserName}'s {cardDto.Card.CardName}"; diceRoll.TextOutlineColor = viewer.DieTextColor; diceRoll.TextFillColor = viewer.DieBackColor; diceRoll.DiceGroup = DiceGroup.Viewers; diceRoll.RollScope = RollScope.Viewer; diceRoll.RollID = cardDto.InstanceID; diceRoll.Viewer = cardDto.Card.UserName; for (int i = 0; i < parameters.Length; i += 2) { string dieLabel = parameters[i + 1].Trim(); string dieStr = parameters[i].Trim(); if (dieStr.Contains("save:")) { foreach (int targetCharacterId in cardDto.TargetCharacterIds) { DiceDto diceDto = AddDieStr(diceRoll, cardDto, viewer, dieStr, dieLabel, targetCharacterId); diceDto.DieCountsAs = DieCountsAs.savingThrow; } } else { AddDieStr(diceRoll, cardDto, viewer, dieStr, dieLabel); } } savedCardsForViewerDieRolls.Add(cardDto); return(diceRoll); }
private void RefreshTrackHue() { if (MiniGrouperScript == null) { trkHue.Value = 0; return; } byte red = (byte)Math.Round(MiniGrouperScript.IndicatorColor.r * 255.0); byte green = (byte)Math.Round(MiniGrouperScript.IndicatorColor.g * 255.0); byte blue = (byte)Math.Round(MiniGrouperScript.IndicatorColor.b * 255.0); System.Drawing.Color color = System.Drawing.Color.FromArgb(red, green, blue); HueSatLight hueSatLight = new HueSatLight(color); trkHue.Value = (int)Math.Round(hueSatLight.Hue * 360.0); }
private void tbxHtml_TextChanged(object sender, EventArgs e) { if (changingTextInternally) { return; } try { HueSatLight hueSatLight = new HueSatLight(tbxHtml.Text); btnSetColor.BackColor = hueSatLight.AsRGB; ColorChanged(true); UpdateTrackbars(); } catch (Exception ex) { Talespire.Log.Exception(ex); MessageBox.Show(ex.Message, ex.GetType().ToString()); } }
public void SetColor(string htmlColorStr) { HueSatLight hueSatLight = new HueSatLight(htmlColorStr); SetColor(hueSatLight); }