statusBar.ts

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