LCOV - code coverage report
Current view: top level - dashql-app/src/views/query_result - data_table_colors.ts Coverage Total Hit
Test: DashQL 915828b Lines: 100.0 % 27 27
Test Date: 2026-11-06 19:30:32

            Line data    Source code
       1              : /// Shared colors of the column summary visualizations (histogram, most frequent, etc.), tokens of the theme.
       2              : /// They are CSS values, the plots set them as style properties since SVG attributes do not resolve var().
       3              : 
       4              : /// Colors for regular (non-null) bars
       5            1 : export const COLUMN_SUMMARY_COLORS = {
       6              :     /// Total bar color when no filter is active
       7            1 :     totalBar: "var(--color_neutral_fg)",
       8              :     /// Total bar color when focused and no filter is active
       9            1 :     totalBarFocused: "var(--color_fg_muted)",
      10              :     /// Total bar color when a filter is active (faded background)
      11            1 :     totalBarWithFilter: "var(--color_border)",
      12              :     /// Total bar color when focused and a filter is active
      13            1 :     totalBarWithFilterFocused: "var(--color_fg_subtle)",
      14              :     /// Filtered bar color (the highlighted portion)
      15            1 :     filteredBar: "var(--color_neutral_fg)",
      16              :     /// Filtered bar color when focused
      17            1 :     filteredBarFocused: "var(--color_fg_muted)",
      18            1 : };
      19              : 
      20              : /// Colors for null value bars
      21            1 : export const COLUMN_SUMMARY_NULL_COLORS = {
      22              :     /// Total null bar color when no filter is active
      23            1 :     totalBar: "var(--color_fg_subtle)",
      24              :     /// Total null bar color when focused and no filter is active
      25            1 :     totalBarFocused: "var(--color_fg_muted)",
      26              :     /// Total null bar color when a filter is active (faded background)
      27            1 :     totalBarWithFilter: "var(--color_border)",
      28              :     /// Total null bar color when focused and a filter is active
      29            1 :     totalBarWithFilterFocused: "var(--color_fg_subtle)",
      30              :     /// Filtered null bar color
      31            1 :     filteredBar: "var(--color_neutral_fg)",
      32              :     /// Filtered null bar color when focused
      33            1 :     filteredBarFocused: "var(--color_fg_muted)",
      34            1 : };
      35              : 
      36              : /// The color of the baseline below the bars
      37            1 : export const COLUMN_SUMMARY_BASELINE_COLOR = "var(--color_border)";
      38              : 
      39              : /// Helper to get the appropriate total bar color based on filter state and focus
      40            1 : export function getTotalBarColor(hasFilter: boolean, isFocused: boolean, isNull: boolean = false): string {
      41            1 :     const colors = isNull ? COLUMN_SUMMARY_NULL_COLORS : COLUMN_SUMMARY_COLORS;
      42            1 :     if (hasFilter) {
      43            1 :         return isFocused ? colors.totalBarWithFilterFocused : colors.totalBarWithFilter;
      44              :     }
      45            1 :     return isFocused ? colors.totalBarFocused : colors.totalBar;
      46            1 : }
      47              : 
      48              : /// Helper to get the appropriate filtered bar color based on focus
      49            1 : export function getFilteredBarColor(isFocused: boolean, isNull: boolean = false): string {
      50            1 :     const colors = isNull ? COLUMN_SUMMARY_NULL_COLORS : COLUMN_SUMMARY_COLORS;
      51            1 :     return isFocused ? colors.filteredBarFocused : colors.filteredBar;
      52            1 : }
        

Generated by: LCOV version 2.0-1