UNPKG

@devexperts/dxcharts-lite

Version:
24 lines (23 loc) 1.11 kB
/* * Copyright (C) 2019 - 2025 Devexperts Solutions IE Limited * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import Color from 'color'; export const VOLUMES_COLOR_OPACITY = 0.3; export const resolveColorForBar = (priceMovement, colors) => { const color = colors.barTheme[`${priceMovement}Color`]; return Color(color).alpha(VOLUMES_COLOR_OPACITY).toString(); }; export const resolveColorUsingConfig = (priceMovement, colors) => { const color = colors.volume[`${priceMovement}BarColor`]; return Color(color).alpha(VOLUMES_COLOR_OPACITY).toString(); }; export const resolveColorForLine = (priceMovement, colors) => { const color = colors.lineTheme[`${priceMovement}Color`]; return Color(color).alpha(VOLUMES_COLOR_OPACITY).toString(); }; export const resolveColorForCandle = (priceMovement, colors) => { const color = colors.candleTheme[`${priceMovement}Color`]; return Color(color).alpha(VOLUMES_COLOR_OPACITY).toString(); };