using Content.Client.Options.UI; using Robust.Shared.Configuration; namespace Content.Client._DV.Options.UI; /// /// Implementation of a CVar option that simply corresponds with a string . /// /// public sealed class OptionColorSliderCVar : BaseOptionCVar { private readonly OptionColorSlider _slider; protected override string Value { get => _slider.Slider.Color.ToHex(); set { _slider.Slider.Color = Color.FromHex(value); UpdateLabelColor(); } } /// /// Creates a new instance of this type. /// /// /// /// It is generally more convenient to call overloads on /// such as instead of instantiating this type directly. /// /// /// The control row that owns this option. /// The configuration manager to get and set values from. /// The CVar that is being controlled by this option. /// The UI control for the option. public OptionColorSliderCVar( OptionsTabControlRow controller, IConfigurationManager cfg, CVarDef cVar, OptionColorSlider slider) : base(controller, cfg, cVar) { _slider = slider; slider.Slider.OnColorChanged += _ => { ValueChanged(); UpdateLabelColor(); }; } private void UpdateLabelColor() { _slider.ExampleLabel.FontColorOverride = Color.FromHex(Value); } }