Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with icons #255

Open
madkarmaa opened this issue Aug 19, 2024 · 4 comments
Open

Issues with icons #255

madkarmaa opened this issue Aug 19, 2024 · 4 comments
Assignees

Comments

@madkarmaa
Copy link
Member

madkarmaa commented Aug 19, 2024

I've come across some issues while using the <Button /> component.

  • There's a limited choice of icons, which need to be added manually

  • The colors of the icons are hardcoded in the SVG code

I had to modify the filter CSS property to make the colors of the icons black/white because the hardcoded blue-ish color they currently have didn't fit on red/yellow backgrounds.

I think having an icon library is better than the current method, such as Google font icons or FontAwesome icons.

A component can be created as well, I've already made one for my own website, it's a really easy solution.

The only downside I can think of is the big size of these CSS files which need to be downloaded by the client.

@oSumAtrIX
Copy link
Member

Any free icon pack package should work and should replace the current SVG icons.

@oSumAtrIX oSumAtrIX moved this to 🏗 In progress in Development of ReVanced Aug 19, 2024
@oSumAtrIX oSumAtrIX moved this from 🏗 In progress to 📋 Backlog in Development of ReVanced Aug 19, 2024
@madkarmaa madkarmaa self-assigned this Aug 20, 2024
@madkarmaa
Copy link
Member Author

madkarmaa commented Nov 8, 2024

Component proposal

Addition in src/lib/types.ts

export enum FAIconFamily {
	CLASSIC = 'classic',
	DUOTONE = 'duotone',
	SHARP = 'sharp',
	SHARP_DUOTONE = 'sharp-duotone'
}

export enum FAIconVariant {
	SOLID = 'solid',
	REGULAR = 'regular',
	LIGHT = 'light',
	THIN = 'thin'
}

New component src/lib/components/Icon.svelte
Ignore the TailwindCSS syntax, it can be easily replaced

<script lang="ts">
	import { FAIconFamily, FAIconVariant } from '@/types';

	type Family = FAIconFamily | `${FAIconFamily}`;
	type Variant = FAIconVariant | `${FAIconVariant}`;

	type IconOptions =
		| {
				brands: true;
		  }
		| {
				brands?: never;
				family: Family;
				variant: Variant;
		  };

	export let name: string;
	export let options: IconOptions = { family: 'classic', variant: 'solid' };

	const classes: string[] = [`fa-${name}`];

	if (options.brands) classes.push('fa-brands');
	else Object.values(options).forEach((option) => classes.push(`fa-${option}`));
</script>

<i class="{classes.join(' ')} mr-2 h-4 w-4 flex justify-center items-center"></i>

Screenshots

<Icon name="house" />

Image

<Icon name="folder" options={{ family: 'duotone', variant: 'light' }} />

Image
P.S.: there's FontAwesome icon files to import. They can be non-premium (or premium, acquired via page inspection 🤐).

@oSumAtrIX
Copy link
Member

Doesn't Fa already provide types

@madkarmaa
Copy link
Member Author

Doesn't Fa already provide types

not that I know of, no

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

No branches or pull requests

2 participants