/// <summary> /// Sets the currently selected color /// </summary> /// <param name="color">The new value for the currently selected color</param> /// <param name="keepTransparency">Whether to keep the current alpha channel unmodified</param> public void SetCurrentColor(AhslColor color, bool keepTransparency = false) { AhslColor oldColor = Color.White.ToAhsl(); if (keepTransparency) { color = new AhslColor(GetCurrentColor().A, color.Hf, color.Sf, color.Lf); } switch (_selectedColor) { case ColorPickerColor.FirstColor: oldColor = _firstColor; FirstAhslColor = color; break; case ColorPickerColor.SecondColor: oldColor = _secondColor; SecondAhslColor = color; break; } UpdateSliders(); ColorPick?.Invoke(this, new ColorPickEventArgs(oldColor.ToColor(), color.ToColor(), _selectedColor)); }
public static Color GetColor(ColorPick color) { switch (color) { case ColorPick.Red: return(Color.red); case ColorPick.Magenta: return(Color.magenta); case ColorPick.Yellow: return(Color.yellow); case ColorPick.Green: return(Color.green); case ColorPick.Blue: return(Color.blue); case ColorPick.Cyan: return(Color.cyan); default: return(Color.white); } }
private void BgColorButton_Click(object sender, EventArgs e) { if (ColorPick.ShowDialog() == DialogResult.OK) { Program.BgColor = ColorPick.Color; pictureBox1.BackColor = Program.BgColor; } SettingsManager.ChangeSetting(SettingsManager.ColorToString(Program.BgColor), "Color"); }
private void Colorpicker_SelectedIndexChanged(object sender, EventArgs e) { var picker = (Picker)sender; int selectedIndex = picker.SelectedIndex; if (selectedIndex >= 0) { ColorPick selected = (ColorPick)picker.SelectedItem; model.Color = selected.Color; } }
internal void setButtons(ColorPick colorPicker) { buttonPanel.chooseButton0.setChooseButton(colorPicker); buttonPanel.chooseButton1.setChooseButton(colorPicker); buttonPanel.chooseButton2.setChooseButton(colorPicker); buttonPanel.chooseButton3.setChooseButton(colorPicker); buttonPanel.chooseButton4.setChooseButton(colorPicker); buttonPanel.chooseButton5.setChooseButton(colorPicker); buttonPanel.toggleSwitch1.setToggleSwitch(colorPicker); buttonPanel.toggleSwitch2.setToggleSwitch(colorPicker); }
public LocationCardPage(LocationViewModel lvm) { model = lvm; BindingContext = model; InitializeComponent(); Title = AppResources.LocationNewPage_Title; colorpicker.ItemsSource = Global.Colors; ColorPick color = Global.Colors.Find(x => x.Color == lvm.Color); if (color is ColorPick) { colorpicker.SelectedItem = color; } }
public ZoneCardPage(ZoneViewModel zvm) { model = zvm; BindingContext = model; InitializeComponent(); colorpicker.ItemsSource = Global.Colors; ColorPick color = Global.Colors.Find(x => x.Color == zvm.Color); if (color is ColorPick) { colorpicker.SelectedItem = color; } UpdateTitle(); MessagingCenter.Subscribe <ZoneViewModel>(this, "LocationsIsLoaded", LocationsIsLoaded); MessagingCenter.Subscribe <ZoneViewModel>(this, "BinTypesIsLoaded", BinTypesIsLoaded); model.State = ModelState.Normal; }
public void Initiliaze(int _startingColor, int _blockedColor) { availableColors = GameData.Instance.Colors.TeamColors; IdSelected = _startingColor; colorPickList = new List <ColorPick>(); int id = 0; foreach (Color color in availableColors) { ColorPick pick = Instantiate(colorPickTemplate, colorPickContainer); pick.SetColor(color); pick.Id = id; pick.SetSelected(id == _startingColor); pick.interactable = id != _blockedColor; id++; pick.onClick.AddListener(delegate { SelectColor(pick.Id); }); colorPickList.Add(pick); } }
public PropertyControl() { InitializeComponent(); propertyPanelController = new PropertyPanelController(this.property_panel); colorPicker = propertyPanelController.colorPicker; }