mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 07:23:22 +00:00
stream_color: Remove spectrum-colorpicker library.
As a follow-up to the previous commit which replaces the spectrum color picker instances with the custom color picker popover, this commit removes the spectrum-colorpicker library and its related code from the codebase.
This commit is contained in:
@@ -2,13 +2,9 @@ import type {Colord} from "colord";
|
||||
import {colord, extend} from "colord";
|
||||
import lchPlugin from "colord/plugins/lch";
|
||||
import mixPlugin from "colord/plugins/mix";
|
||||
import $ from "jquery";
|
||||
import type tinycolor from "tinycolor2";
|
||||
|
||||
import {$t} from "./i18n.ts";
|
||||
import * as settings_data from "./settings_data.ts";
|
||||
import * as stream_data from "./stream_data.ts";
|
||||
import * as stream_settings_api from "./stream_settings_api.ts";
|
||||
|
||||
extend([lchPlugin, mixPlugin]);
|
||||
|
||||
@@ -69,47 +65,3 @@ export const stream_color_palette = [
|
||||
["#a6dcbf", "#addfe5", "#a6c7e5", "#4f8de4", "#95a5fd", "#b0a5fd"],
|
||||
["#c2c2c2", "#c8bebf", "#c6a8ad", "#e79ab5", "#bd86e5", "#9987e1"],
|
||||
];
|
||||
|
||||
const subscriptions_table_colorpicker_options = {
|
||||
clickoutFiresChange: true,
|
||||
showPalette: true,
|
||||
showInput: true,
|
||||
palette: stream_color_palette,
|
||||
change: picker_do_change_color,
|
||||
};
|
||||
|
||||
export function set_colorpicker_color($colorpicker: JQuery, color: string): void {
|
||||
$colorpicker.spectrum({
|
||||
...subscriptions_table_colorpicker_options,
|
||||
color,
|
||||
});
|
||||
}
|
||||
|
||||
export const sidebar_popover_colorpicker_options_full = {
|
||||
clickoutFiresChange: false,
|
||||
showPalette: true,
|
||||
showInput: true,
|
||||
flat: true,
|
||||
cancelText: "",
|
||||
chooseText: $t({defaultMessage: "Confirm"}),
|
||||
palette: stream_color_palette,
|
||||
change: picker_do_change_color,
|
||||
};
|
||||
|
||||
function picker_do_change_color(this: HTMLElement, color: tinycolor.Instance): void {
|
||||
$(".colorpicker").spectrum("destroy");
|
||||
$(".colorpicker").spectrum(sidebar_popover_colorpicker_options_full);
|
||||
const stream_id = Number.parseInt($(this).attr("stream_id")!, 10);
|
||||
const hex_color = color.toHexString();
|
||||
stream_settings_api.set_color(stream_id, hex_color);
|
||||
}
|
||||
|
||||
export const sidebar_popover_colorpicker_options = {
|
||||
clickoutFiresChange: true,
|
||||
showPaletteOnly: true,
|
||||
showPalette: true,
|
||||
showInput: true,
|
||||
flat: true,
|
||||
palette: stream_color_palette,
|
||||
change: picker_do_change_color,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user