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

Request: Social Icons: icon color, use variable instead of hex code #36462

Closed
Sandstromer opened this issue Nov 13, 2021 · 2 comments · Fixed by #51020
Closed

Request: Social Icons: icon color, use variable instead of hex code #36462

Sandstromer opened this issue Nov 13, 2021 · 2 comments · Fixed by #51020
Assignees
Labels
[Block] Social Affects the Social Block - used to display Social Media accounts [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.

Comments

@Sandstromer
Copy link

Sandstromer commented Nov 13, 2021

What problem does this address?

Currently when adding a Social Icons block and changing either the icon color or icon background color, the selected color is added using the color's hex code, rather than the global color variable.

What is your proposed solution?

Use the global color variable instead of the hex code.

This would be hugely benefical for child themes, or when editing a global color in the color palette.

For example a parent theme has a template part containing the Social Icons block, with either the icon or background color using a theme color. A child theme would then be able to use a different color palette (with same color names) and the social media icons would display in the correct color for that child theme, rather than the hardcoded hex color of the parent theme.

Another example is when a user edits the global color styles to change the color, currently they would also have to edit all templates, pages, posts etc where the Social Icons block is in use, and manually change the icon/background color to the correct color.

@Sandstromer
Copy link
Author

Sandstromer commented Nov 13, 2021

This is how the block markup currently looks:

<!-- wp:social-links {
	"iconColor":"primary",
	"iconColorValue":"#000000",
	"iconBackgroundColor":"secondary",
	"iconBackgroundColorValue":"#ffffff"
} -->

The variable names iconColor & iconBackgroundColor are already present, so is there any reason why the corresponding iconColorValue & iconBackgroundColorValue are also needed?

Testing this in a theme template seems to work using the encoded variable in place of the hex code:

<!-- wp:social-links {
	"iconColor":"primary",
	"iconColorValue":"var(\u002d\u002dwp\u002d\u002dpreset\u002d\u002dcolor\u002d\u002dprimary)",
	"iconBackgroundColor":"secondary",
	"iconBackgroundColorValue":"var(\u002d\u002dwp\u002d\u002dpreset\u002d\u002dcolor\u002d\u002dsecondary)"
} -->

But this doesn't help with user added Social Icons blocks, as it is much too complicated to expect users to switch to code editor and enter the variables like this.

@Sandstromer Sandstromer changed the title Request: Social Media icon color, use variable instead of hex code Request: Social Icons: icon color, use variable instead of hex code Nov 13, 2021
@skorasaurus skorasaurus added [Block] Social Affects the Social Block - used to display Social Media accounts [Type] Enhancement A suggestion for improvement. labels Nov 14, 2021
@carolinan
Copy link
Contributor

This is also preventing having different colors for social links in global style variations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Social Affects the Social Block - used to display Social Media accounts [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.
Projects
None yet
5 participants