Aura Theme

Aura API

## createPort Used to create a port file in disk from a given template file path.
> Definition: ```ts interface PortCompiler { template: string replacements: Record outputFileName?: string outputDist?: string showDebugLogs?: boolean } createPort(props: PortCompiler): Promise {} ``` - **template**:
The path of the file to apply the replacements. - **replacements**:
An object to be used for the template engine to replace values based on the name of the keys. - **outputFileName**?:
The name to be used as output *(just the name without the file extension)* - **outputDist**?:
A path to override the default `/packages` to compile the file. - **showDebugLogs**?:
Self-descriptive, default is `true`. > Example: ```ts await createPort({ template: resolve(templateFolder, `aura-theme.js`), replacements: colorSchemes.dark, }) ```
## createInMemoryPort Used to create a port in memory. > This is useful, for example, when you need to convert one port to another before creating it in disk.
> Definition: ```ts interface PortInMemoryCompiler { template: string replacements: Record } createInMemoryPort(props: PortInMemoryCompiler): Promise {} ``` - **template**:
The path of the file to apply the replacements. - **replacements**:
An object to be used for the template engine to replace values based on the name of the keys. > Example: ```ts await createInMemoryPort({ template: resolve(templateFolder, `aura-theme.js`), replacements: { portName: 'Aura Theme', }, }) ```
## createFromInMemoryPort Used to create a port file in disk from an in memory one.
> Definition: ```ts interface PortFromInMemoryCompiler { template: string output: string } createFromInMemoryPort(props: PortFromInMemoryCompiler): Promise {} ``` - **template**:
The in memory port to be created in disk. - **output**:
The path where the port will be created. > Example: ```ts await createFromInMemoryPort({ template: templateInMemory, output: resolve( constants.folders.distFolder, 'aura-port', 'aura-theme.json' ), }) ```
## createReadme Used to create a README.md in disk from a given template file path. > The values at "theme" property in the root "package.json" file will be injected by default to also fill the template.
> Definition: ```ts interface DocumentCompiler { template: string replacements: Record outputFileName?: string outputDist?: string showDebugLogs?: boolean } createReadme(props: DocumentCompiler): Promise {} ``` - **template**:
the path of the file to apply the replacements. - **replacements**:
an object to be used for the template engine to replace values based on the name of the keys. - **outputFileName**?:
The name to be used as output *(just the name without the file extension)* - **outputDist**?:
A path to override the default `/packages` to compile the file. - **showDebugLogs**?:
self-descriptive, default is `true`. > Example: ```ts await createReadme({ template: resolve('path', 'to', 'README.md'), replacements: { portName: 'Visual Studio Code', }, }) ```
## copyExtraFiles Used to copy all files and folders inside a folder named as **"extra"** inside your port folder, keeping their structure. > This is useful to add files in the dist version that you don't need to change their content dynamically at the build process.
> Definition: ```ts copyExtraFiles(portRootFolder: string, outputFolder: string = ''): Promise {} ``` - **portRootFolder**:
The root folder where the **"extra"** folder lives. - **outputFolder**:
The output folder where the files will be copied to, if not provided, the default port folder dist will be used: `/packages`. > Example: ```ts await copyExtraFiles(__dirname) ```
## colorHandlers - tokenize

Used to convert hex colors in a given string to Aura accent tokens.

> This is useful to convert the ports you are creating by hard coding the hex colors for testing to the tokenized port template version. > Definition: ```ts tokenize(content: string): string {} ``` - **content**:
A string containing hex colors to be replaced to their respective Aura accent tokens.

> Example: ```ts tokenize(`"activityBar.activeBorder": "#a277ff",`) // "activityBar.activeBorder": "{{ accent1 }}", ```
- desaturate

Decreases the intensity of a color. Its range is between 0 to 1. The first argument of the desaturate function is the amount by how much the color intensity should be decreased.

> Definition: ```ts desaturate(amount: string | number): (color: string) => string ``` - **amount**:
The value to be decreased. - **color**:
The color to apply the desaturation. > Example: ```ts const applyDesaturation = desaturate(0.2) applyDesaturation('#CCCD64') // #b8b979 ```
- shade

Shades a color by mixing it with black. shade can produce hue shifts, where as darken manipulates the luminance channel and therefore doesn't produce hue shifts.

> Definition: ```ts shade(percentage: string | number): (color: string) => string ``` - **percentage**:
The shade percentage - **color**:
The color to apply the shade > Example: ```ts const applyShade = shade(0.25) applyShade('#00f') // #00003f ```
- hexToRgb

Used to convert a Hex value to RGB.

> Definition: ```ts hexToRgb(color: string): number[] {} ``` - **colors**:
The Hex value to be converted. > Example: ```ts hexToRgb('#a277ff') // [162, 119, 255] ```
- rgbToHex

Used to convert a RGB value to Hex.

> Definition: ```ts rgbToHex(color: [number, number, number]): string {} ``` - **colors**:
The RGB array to be converted. > Example: ```ts rgbToHex([162, 119, 255]) // #a277ff ```
- schemeToRgb

Used to convert the values of a hex color scheme to RGB.

> Definition: ```ts schemeToRgb(colors: Record): Record {} ``` - **colors**:
A hex color scheme object > Example: ```ts schemeToRgb(colorSchemes.dark) // { accent1: [162, 119, 255], accent2: [97, 255, 202], ... } ```
- schemeToTerminalRgb

Used to convert the values of a hex color scheme to RGB scheme compatible with iTerm.

> Definition: ```ts schemeToTerminalRgb(colors: Record): Record {} ``` - **colors**:
A hex color scheme object > Example: ```ts schemeToTerminalRgb(colorSchemes.dark) /*{ accent1_red: 0.6352941176470588, accent1_green: 0.4666666666666667, accent1_blue: 1, accent2_red: 0.3803921568627451, accent2_green: 1, accent2_blue: 0.792156862745098, }*/ ```
- [terminalConvertion](https://github.com/daltonmenezes/aura-theme/blob/main/%40types/termcolors/termcolors.ts) ## colorSchemes - [dark](https://github.com/daltonmenezes/aura-theme/blob/main/src/core/colors/schemes/dark.ts) - [darkSoft](https://github.com/daltonmenezes/aura-theme/blob/main/src/core/colors/schemes/dark.ts) - [softDark](https://github.com/daltonmenezes/aura-theme/blob/main/src/core/colors/schemes/soft-dark.ts) - [softDarkSoft](https://github.com/daltonmenezes/aura-theme/blob/main/src/core/colors/schemes/soft-dark.ts) ## getAllFiles Used get all files from a root folder recursively.
> Definition: ```ts getAllFiles(directory: string, files: string[] = []): Promise {} ``` - **directory**:
The root directory to get all file paths. - **files**:
Used to store the paths recursively, you don't need to pass it manually. > Example: ```ts await getAllFiles('/path/to/folder') // ['path/to/file1.ext', 'path/folder/to/file2.ext'] ```
## unlink Used to remove files and folders recursively.
> Definition: ```ts unlink(path: string): Promise {} ``` - **path**:
A file or folder path to be removed. > Example: ```ts await unlink('/path/to/file/or/folder') ```
## getPathByPlatformInDev Used to get a path in the provided object for the current platform in development. > If the platform doesn't exist in the provided object, an empty string will be returned.
> Definition: ```ts getPathByPlatformInDev(pathsPerPlatform: Record): string {} ``` - **pathsPerPlatform**:
An object with paths per platform id and their values. > Example: ```ts getPathByPlatformInDev({ darwin: '/some/path', linux: '/other/path' }) // '/some/path' ```
## zip - addFile(path: string): void - writeZip(path: string): void - zipFolder(targetFolder: string, outputPath: string): Promise ## toCamelCase Used to transform a string to camel-case.
> Definition: ```ts toCamelCase(str: string, separator: string): string ``` - **str**:
A string to be converted to camel-case. - **separator**:
The separator to be used to split the string and apply the camel-case transformation. > Example: ```ts toCamelCase('aura-theme', '-') // 'auraTheme' ```
## toPortName Used to convert a string to a valid port name *(PascalCase)*.
> Definition: ```ts toPortName(name: string): string {} ``` - **name**:
The name of the port separated by hiphens. > Example: ```ts toPortName('aura-theme') // 'AuraTheme' ```
## capitalizeFirstLetter Used to capitalize only the first letter in a given text.
> Definition: ```ts capitalizeFirstLetter(rawText: string): string {} ``` - **rawText**:
A string to capitalize the first letter. > Example: ```ts capitalizeFirstLetter('aura theme') // 'Aura theme' ```
## constants - isDev : *boolean* - isProd : *boolean* - [info](https://github.com/daltonmenezes/aura-theme/blob/main/package.json#L4-L18) - [emojis](https://github.com/daltonmenezes/aura-theme/blob/main/src/shared/constants/emojis.ts) - [files](https://github.com/daltonmenezes/aura-theme/blob/main/src/shared/constants/files.ts) - [folders](https://github.com/daltonmenezes/aura-theme/blob/main/src/shared/constants/folders.ts) # License [MIT © Dalton Menezes](https://github.com/daltonmenezes/aura-theme/blob/main/LICENSE)