import type { Template } from './index.js'; import { colorSetToVariants } from '../color-set/index.js'; import Color from 'color'; import { source } from 'common-tags'; function format(hex: string): string { return ( '0x00' + Color(hex) .rgb() .array() .reverse() .map((n) => Math.round(n)) .map((n) => n.toString(16).toUpperCase()) .join('') ); } function mix(aHex: string, bHex: string, mix = 0.5) { return format(Color(aHex).mix(Color(bHex), mix).hex()); } const template: Template = { name: 'Visual Studio', render: async function* (colorSet) { const variants = colorSetToVariants(colorSet); for (const { colors, isDark, title } of variants) { const { shade0, shade1, shade2, shade3, shade4, shade5, shade6, shade7, accent0, accent1, accent2, accent3, accent4, accent5, accent6, accent7, } = colors; yield { path: `${title.kebab}.vssettings`, content: source` 2 `, }; } }, renderInstructions: (paths) => source` 1. Select Tools > Import and Export Settings... 2. Choose the "Import selected environment settings" option 3. Choose whether or not to save a backup of current settings 4. Click "Browse..." and choose the generated theme file (${paths .map((p) => `'${p}'`) .join(' or ')}) 5. Click "Finish" `, }; export default template;