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