statusBar.ts

  1import Theme from "../themes/common/theme";
  2import { backgroundColor, border, iconColor, text } from "./components";
  3import { workspaceBackground } from "./workspace";
  4
  5export default function statusBar(theme: Theme) {
  6  const statusContainer = {
  7    cornerRadius: 6,
  8    padding: { top: 3, bottom: 3, left: 6, right: 6 },
  9  };
 10
 11  const diagnosticStatusContainer = {
 12    cornerRadius: 6,
 13    padding: { top: 1, bottom: 1, left: 6, right: 6 },
 14  };
 15
 16  return {
 17    height: 30,
 18    itemSpacing: 8,
 19    padding: {
 20      top: 1,
 21      bottom: 1,
 22      left: 6,
 23      right: 6,
 24    },
 25    border: border(theme, "primary", { top: true, overlay: true }),
 26    cursorPosition: text(theme, "sans", "secondary"),
 27    autoUpdateProgressMessage: text(theme, "sans", "secondary"),
 28    autoUpdateDoneMessage: text(theme, "sans", "secondary"),
 29    lspStatus: {
 30      ...diagnosticStatusContainer,
 31      iconSpacing: 4,
 32      iconWidth: 14,
 33      height: 18,
 34      message: text(theme, "sans", "secondary"),
 35      iconColor: iconColor(theme, "muted"),
 36      hover: {
 37        message: text(theme, "sans", "primary"),
 38        iconColor: iconColor(theme, "primary"),
 39        background: backgroundColor(theme, 300, "hovered"),
 40      },
 41    },
 42    diagnosticMessage: {
 43      ...text(theme, "sans", "secondary"),
 44      hover: text(theme, "sans", "active"),
 45    },
 46    feedback: {
 47      ...text(theme, "sans", "secondary"),
 48      hover: text(theme, "sans", "active"),
 49    },
 50    diagnosticSummary: {
 51      height: 16,
 52      iconWidth: 16,
 53      iconSpacing: 2,
 54      summarySpacing: 6,
 55      text: text(theme, "sans", "primary", { size: "sm" }),
 56      iconColorOk: iconColor(theme, "muted"),
 57      iconColorWarning: iconColor(theme, "warning"),
 58      iconColorError: iconColor(theme, "error"),
 59      containerOk: {
 60        cornerRadius: 6,
 61        padding: { top: 3, bottom: 3, left: 7, right: 7 },
 62      },
 63      containerWarning: {
 64        ...diagnosticStatusContainer,
 65        background: backgroundColor(theme, "warning"),
 66        border: border(theme, "warning"),
 67      },
 68      containerError: {
 69        ...diagnosticStatusContainer,
 70        background: backgroundColor(theme, "error"),
 71        border: border(theme, "error"),
 72      },
 73      hover: {
 74        iconColorOk: iconColor(theme, "active"),
 75        containerOk: {
 76          cornerRadius: 6,
 77          padding: { top: 3, bottom: 3, left: 7, right: 7 },
 78          background: backgroundColor(theme, 300, "hovered"),
 79        },
 80        containerWarning: {
 81          ...diagnosticStatusContainer,
 82          background: backgroundColor(theme, "warning", "hovered"),
 83          border: border(theme, "warning"),
 84        },
 85        containerError: {
 86          ...diagnosticStatusContainer,
 87          background: backgroundColor(theme, "error", "hovered"),
 88          border: border(theme, "error"),
 89        },
 90      },
 91    },
 92    sidebarButtons: {
 93      groupLeft: {},
 94      groupRight: {},
 95      item: {
 96        ...statusContainer,
 97        iconSize: 16,
 98        iconColor: iconColor(theme, "muted"),
 99        hover: {
100          iconColor: iconColor(theme, "active"),
101          background: backgroundColor(theme, 300, "hovered"),
102        },
103        active: {
104          iconColor: iconColor(theme, "active"),
105          background: backgroundColor(theme, 300, "active"),
106        },
107      },
108      badge: {
109        cornerRadius: 3,
110        padding: 2,
111        margin: { bottom: -1, right: -1 },
112        border: { width: 1, color: workspaceBackground(theme) },
113        background: iconColor(theme, "feature"),
114      },
115    },
116  };
117}