Home / File/ icons.ts — astro Source File

icons.ts — astro Source File

Architecture documentation for icons.ts, a typescript file in the astro codebase. 1 imports, 0 dependents.

File typescript DevToolbar ToolbarClient 1 imports 3 functions

Entity Profile

Dependency Diagram

graph LR
  9038303f_ab7f_4de5_58f6_bbab3a318f46["icons.ts"]
  d155afbb_2b9b_f044_9694_67c961036a0a["../astro.js"]
  9038303f_ab7f_4de5_58f6_bbab3a318f46 --> d155afbb_2b9b_f044_9694_67c961036a0a
  style 9038303f_ab7f_4de5_58f6_bbab3a318f46 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { Integration } from '../astro.js';

function randomFromArray<T>(list: T[]) {
	return list[Math.floor(Math.random() * list.length)];
}

const categoryIcons = new Map(
	Object.entries({
		frameworks: ['puzzle', 'grid'],
		adapters: ['puzzle', 'grid', 'compress'],
		'css+ui': ['compress', 'grid', 'image', 'resizeImage', 'puzzle'],
		'performance+seo': ['approveUser', 'checkCircle', 'compress', 'robot', 'searchFile', 'sitemap'],
		analytics: ['checkCircle', 'compress', 'searchFile'],
		accessibility: ['approveUser', 'checkCircle'],
		other: ['checkCircle', 'grid', 'puzzle', 'sitemap'],
	}),
);

export function iconForIntegration(integration: Integration) {
	const icons = integration.categories
		.filter((category: string) => categoryIcons.has(category))
		.map((category: string) => categoryIcons.get(category)!)
		.flat();

	return randomFromArray(icons);
}

const iconColors = [
	'#BC52EE',
	'#6D6AF0',
	'#52EEBD',
	'#52B7EE',
	'#52EE55',
	'#B7EE52',
	'#EEBD52',
	'#EE5552',
	'#EE52B7',
	'#858B98',
];

export function colorForIntegration() {
	return randomFromArray(iconColors);
}

Domain

Subdomains

Dependencies

  • ../astro.js

Frequently Asked Questions

What does icons.ts do?
icons.ts is a source file in the astro codebase, written in typescript. It belongs to the DevToolbar domain, ToolbarClient subdomain.
What functions are defined in icons.ts?
icons.ts defines 3 function(s): colorForIntegration, iconForIntegration, randomFromArray.
What does icons.ts depend on?
icons.ts imports 1 module(s): ../astro.js.
Where is icons.ts in the architecture?
icons.ts is located at packages/astro/src/runtime/client/dev-toolbar/apps/utils/icons.ts (domain: DevToolbar, subdomain: ToolbarClient, directory: packages/astro/src/runtime/client/dev-toolbar/apps/utils).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free