import type { IconColor, IconBase, IconDb, IconDbItem } from './types'; /** * Icon * * @see {@link https://github.com/websemantics/file-icons-js/blob/master/index.js#L1107} */ /** * Create Icon instance */ declare class Icon { /** Index of the icon's appearance in the enclosing array */ index: number; /** Icon's CSS class (e.g., "js-icon") */ icon: string; /** Icon's color classes */ color: IconColor; /** Pattern for matching names or pathnames */ match: RegExp; /** priority that determined icon's order of appearance */ priority: number; /** Match against system path instead of basename */ matchPath: boolean; /** to match executable names in hashbangs */ interpreter: RegExp | null; /** to match grammar scope-names */ scope: RegExp | null; /** to match alias patterns */ lang: RegExp | null; /** to match file signatures */ signature: RegExp | null; constructor(index: number, data: IconBase); /** * Return the CSS classes for displaying the icon. * * @param {Number|null} colorMode * @param {Boolean} asArray * @return {String} */ getClass(colorMode?: number | null, asArray?: boolean): string | (string | null)[]; } interface IconTable { byName: Icon[]; byInterpreter: Icon[]; byLanguage: Icon[]; byPath: Icon[]; byScope: Icon[]; bySignature: Icon[]; } /** * Create IconTables instance */ declare class IconTables { /** Icons to match directory-type resources. */ directoryIcons: IconTable; /** Icons to match file resources. */ fileIcons: IconTable; /** Icon for binary files. */ binaryIcon: Icon | null; /** Icon for executables. */ executableIcon: Icon | null; constructor(data: IconDb); /** * Populate icon-lists from a icons data table. */ read(table: IconDbItem): IconTable; /** * Match an icon using a resource's basename. * * @param name - Name of filesystem entity * @param directory - Match folders instead of files */ matchName(name: string, directory?: boolean): Icon | null; /** * Match an icon using a resource's system path. * * @param path - Full pathname to check * @param directory - Match folders instead of files */ matchPath(path: string, directory?: boolean): Icon | null; /** * Match an icon using the human-readable form of its related language. * * Typically used for matching modelines and Linguist-language attributes. * * @example IconTables.matchLanguage("JavaScript") * @param name - Name/alias of language */ matchLanguage(name: string): Icon | null; /** * Match an icon using the grammar-scope assigned to it. * * @example IconTables.matchScope("source.js") * @param {String} name * @return {Icon} */ matchScope(name: string): Icon | null; /** * Match an icon using the name of an interpreter which executes its language. * * Used for matching interpreter directives (a.k.a., "hashbangs"). * * @example IconTables.matchInterpreter("bash") */ matchInterpreter(name: string): Icon | null; } export declare const db: IconTables; /** * Get icon class name of the provided filename. If not found, default to text icon. * * @param name - file name * @return the icon's class * @public */ export declare const getClass: (name: string, match?: Icon | null) => string | (string | null)[] | null; /** * Get icon class name of the provided filename with color. If not found, default to text icon. * * @param name - file name * @return the icon's class * @public */ export declare const getClassWithColor: (name: string, match?: Icon | null) => string | (string | null)[] | null; /** * Get icon class name of the provided filename with dark color. If not found, default to text icon. * * @param name - file name * @return the icon's class * @public */ export declare const getClassWithDarkColor: (name: string, match?: Icon | null) => string | (string | null)[] | null; export {};