import { colorToRgba , overrideOpacity } from '../../../../../common/color_library_wrappers' ; import { Stroke , Fill , Rect } from '../../../../../geoms/types' ; import { getColorFromVariant } from '../../../../../utils/common' ; import { GeometryStateStyle , RectStyle , RectBorderStyle } from '../../../../../utils/themes/theme' ; import { getTextureStyles } from '../../../utils/texture' ; internal export function buildBarStyle ( ctx , imgCanvas , baseColor , themeRectStyle , themeRectBorderStyle , geometryStateStyle , rect ) { const texture = getTextureStyles ( ctx , imgCanvas , baseColor , geometryStateStyle . opacity , themeRectStyle . texture ) ; const fillColor = overrideOpacity ( colorToRgba ( getColorFromVariant ( baseColor , themeRectStyle . fill ) ) , ( opacity ) => opacity * themeRectStyle . opacity * geometryStateStyle . opacity ) ; const fill = { color : fillColor , texture , } ; const strokeColor = overrideOpacity ( colorToRgba ( getColorFromVariant ( baseColor , themeRectBorderStyle . stroke ) ) , ( opacity ) => opacity * geometryStateStyle . opacity * ( themeRectBorderStyle . strokeOpacity ?? themeRectStyle . opacity ) ) ; const stroke = { color : strokeColor , width : themeRectBorderStyle . visible && rect . height > themeRectBorderStyle . strokeWidth ? themeRectBorderStyle . strokeWidth : 0 , } ; return { fill , stroke } ; }