From 9ca9c56e6bc5d2750971e04a2df7028f5c472b8b Mon Sep 17 00:00:00 2001 From: Matt Provost Date: Thu, 15 Jun 2023 19:37:36 +0000 Subject: [PATCH] Remove color_util Signed-off-by: Matt Provost --- src/plugins/maps_legacy/public/index.ts | 3 -- .../maps_legacy/public/map/color_util.js | 47 ------------------- 2 files changed, 50 deletions(-) delete mode 100644 src/plugins/maps_legacy/public/map/color_util.js diff --git a/src/plugins/maps_legacy/public/index.ts b/src/plugins/maps_legacy/public/index.ts index 25be07dc3ca1..4dbbfc13e30f 100644 --- a/src/plugins/maps_legacy/public/index.ts +++ b/src/plugins/maps_legacy/public/index.ts @@ -32,8 +32,6 @@ import { PluginInitializerContext } from 'opensearch-dashboards/public'; import { MapsLegacyPlugin } from './plugin'; // @ts-ignore -import * as colorUtil from './map/color_util'; -// @ts-ignore import { OpenSearchDashboardsMapLayer } from './map/opensearch_dashboards_map_layer'; // @ts-ignore import { convertToGeoJson } from './map/convert_to_geojson'; @@ -59,7 +57,6 @@ export function plugin(initializerContext: PluginInitializerContext) { export { getPrecision, geoContains, - colorUtil, convertToGeoJson, IServiceSettings, OpenSearchDashboardsMapLayer, diff --git a/src/plugins/maps_legacy/public/map/color_util.js b/src/plugins/maps_legacy/public/map/color_util.js deleted file mode 100644 index 0a5f1724af6d..000000000000 --- a/src/plugins/maps_legacy/public/map/color_util.js +++ /dev/null @@ -1,47 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export function getLegendColors(colorRamp, numLegendColors = 4) { - const colors = []; - colors[0] = getColor(colorRamp, 0); - for (let i = 1; i < numLegendColors - 1; i++) { - colors[i] = getColor(colorRamp, Math.floor((colorRamp.length * i) / numLegendColors)); - } - colors[numLegendColors - 1] = getColor(colorRamp, colorRamp.length - 1); - return colors; -} - -export function getColor(colorRamp, i) { - const color = colorRamp[i][1]; - const red = Math.floor(color[0] * 255); - const green = Math.floor(color[1] * 255); - const blue = Math.floor(color[2] * 255); - return `rgb(${red},${green},${blue})`; -}