Skip to content

3) Color Picker

Aaron C Robinson edited this page Sep 6, 2018 · 4 revisions

SettingsHelper includes a Color Picker utility original implemented by KiameV for rimworld-recolorzones. Here is an example that utilizes it.

  • First make sure we are using the appropriate namespace, ColorPicker.Dialog
listing_Standard.AddColorPickerButton("BMM_HuntingIndicatorSizeLabel".Translate(), settings.overlayColors.wildlifeHostiles, (SelectionColorWidget scw) => {
    settings.overlayColors.wildlifeHostiles = scw.SelectedColor;
    settings.overlayColors.wildlifeHostilesFaded = BetterMiniMapSettings.FadedColor(scw.SelectedColor);
});

Example from: BetterMiniMap's ModSettings

SelectionColorWidget tracks the selection in the widget's UI and then allows an action to be called used as a callback (to store the selection setting change).

Translation

Currently translations for the content in the SettingsHelper require each mod to have the language data.

Example data:

<SH_ColorPresetHelp>To use a preset, click on it. To change a preset, hold shift to select the present to change.</SH_ColorPresetHelp>
Clone this wiki locally