workspace.ts

  1import Theme from "../themes/theme";
  2import { backgroundColor, border, iconColor, text } from "./components";
  3
  4export default function workspace(theme: Theme) {
  5  const signInPrompt = {
  6    ...text(theme, "sans", "secondary", { size: "xs" }),
  7    border: border(theme, "primary"),
  8    cornerRadius: 6,
  9    margin: {
 10      top: 1,
 11      right: 6,
 12    },
 13    padding: {
 14      left: 6,
 15      right: 6,
 16    },
 17  };
 18
 19  const tab = {
 20    height: 32,
 21    background: backgroundColor(theme, 300),
 22    iconClose: iconColor(theme, "muted"),
 23    iconCloseActive: iconColor(theme, "active"),
 24    iconConflict: iconColor(theme, "warning"),
 25    iconDirty: iconColor(theme, "info"),
 26    iconWidth: 8,
 27    spacing: 8,
 28    text: text(theme, "sans", "secondary", { size: "sm" }),
 29    border: border(theme, "primary", {
 30      left: true,
 31      bottom: true,
 32      overlay: true,
 33    }),
 34    padding: {
 35      left: 8,
 36      right: 8,
 37    },
 38  };
 39
 40  const activeTab = {
 41    ...tab,
 42    background: backgroundColor(theme, 500),
 43    text: text(theme, "sans", "active", { size: "sm" }),
 44    border: {
 45      ...tab.border,
 46      bottom: false,
 47    },
 48  };
 49
 50  const sidebarItem = {
 51    height: 32,
 52    iconColor: iconColor(theme, "secondary"),
 53    iconSize: 18,
 54  };
 55  const sidebar = {
 56    width: 30,
 57    background: backgroundColor(theme, 300),
 58    border: border(theme, "primary", { right: true }),
 59    item: sidebarItem,
 60    activeItem: {
 61      ...sidebarItem,
 62      iconColor: iconColor(theme, "active"),
 63    },
 64    resizeHandle: {
 65      background: border(theme, "primary").color,
 66      padding: {
 67        left: 1,
 68      },
 69    },
 70  };
 71
 72  return {
 73    background: backgroundColor(theme, 300),
 74    leaderBorderOpacity: 0.7,
 75    leaderBorderWidth: 2.0,
 76    tab,
 77    activeTab,
 78    leftSidebar: {
 79      ...sidebar,
 80      border: border(theme, "primary", { right: true }),
 81    },
 82    rightSidebar: {
 83      ...sidebar,
 84      border: border(theme, "primary", { left: true }),
 85    },
 86    paneDivider: {
 87      color: border(theme, "secondary").color,
 88      width: 1,
 89    },
 90    status_bar: {
 91      height: 24,
 92      itemSpacing: 8,
 93      padding: {
 94        left: 6,
 95        right: 6,
 96      },
 97      border: border(theme, "primary", { top: true, overlay: true }),
 98      cursorPosition: text(theme, "sans", "muted"),
 99      diagnosticMessage: text(theme, "sans", "muted"),
100      lspMessage: text(theme, "sans", "muted"),
101      autoUpdateProgressMessage: text(theme, "sans", "muted"),
102      autoUpdateDoneMessage: text(theme, "sans", "muted"),
103    },
104    titlebar: {
105      avatarWidth: 18,
106      height: 32,
107      background: backgroundColor(theme, 100),
108      shareIconColor: iconColor(theme, "secondary"),
109      shareIconActiveColor: iconColor(theme, "feature"),
110      title: text(theme, "sans", "primary"),
111      avatar: {
112        cornerRadius: 10,
113        border: {
114          color: "#00000088",
115          width: 1,
116        },
117      },
118      avatarRibbon: {
119        height: 3,
120        width: 12,
121        // TODO: The background for this ideally should be 
122        // set with a token, not hardcoded in rust
123      },
124      border: border(theme, "primary", { bottom: true }),
125      signInPrompt,
126      hoveredSignInPrompt: {
127        ...signInPrompt,
128        ...text(theme, "sans", "active", { size: "xs" }),
129      },
130      offlineIcon: {
131        color: iconColor(theme, "secondary"),
132        width: 16,
133        padding: {
134          right: 4,
135        },
136      },
137      outdatedWarning: {
138        ...text(theme, "sans", "warning"),
139        size: 13,
140      },
141    },
142    toolbar: {
143      height: 34,
144      background: backgroundColor(theme, 500),
145      border: border(theme, "secondary", { bottom: true }),
146      itemSpacing: 8,
147      padding: { left: 16, right: 8, top: 4, bottom: 4 },
148    },
149    breadcrumbs: {
150      ...text(theme, "mono", "secondary"),
151      padding: { left: 6 },
152    },
153    disconnectedOverlay: {
154      ...text(theme, "sans", "active"),
155      background: "#000000aa",
156    },
157  };
158}