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

カラーパレットのCSS変数はコアの変数名--wp--preset--color--$slugに合わせないと色が当たらないことがある #1446

Closed
3 tasks done
shimotmk opened this issue Oct 7, 2022 · 2 comments

Comments

@shimotmk
Copy link
Contributor

shimotmk commented Oct 7, 2022

WordPress 6.1より画像ブロックなどでボーダー ブロックのサポートされた
上下左右異なるカラーを設定できる
WordPress/gutenberg#31366

Screen.Recording.2022-07-15.at.11.31.52.am.mp4

テーマはTT2などのブロックテーマ

レンダリングされるHTML

<figure class="wp-block-image size-large has-custom-border">
<img decoding="async" src="https://www.vektor-inc.co.jp/wp-content/uploads/2020/08/vk-blocks-logo_og.png" alt="" style="border-top-color:var(--wp--preset--color--vivid-red);border-top-width:20px;border-right-color:var(--wp--preset--color--luminous-vivid-orange);border-right-width:20px;border-bottom-color:var(--wp--preset--color--vk-color-custom-3);border-bottom-width:20px;border-left-color:var(--wp--preset--color--vivid-cyan-blue);border-left-width:20px">
</figure>

インラインスタイルでborder-right-color:var(--wp--preset--color--$slug)を追加してそれぞれの色を指定している

現状のカラーパレットマネージャーで出力されるCSS変数はスラッグ名のみ(例--vk-color-custom-1)なので--wp--preset--color--$slugが必要です
https://github.com/vektor-inc/vk-color-palette-manager/blob/e93a74ae178338b6f190457fed91f0158a6d2461/src/VkColorPaletteManager.php


--vk-color-primary、--vk-color-custom-1などのcss変数を--wp--preset--color--$slugに変更する

@shimotmk
Copy link
Contributor Author

VK Blocks側では vektor-inc/vk-color-palette-manager#15 がリリースされた後に--vk-color-custom-1などのcss変数を--wp--preset--color--に変更する

@shimotmk
Copy link
Contributor Author

各種対応が終わったと思うのでcloseします

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

No branches or pull requests

1 participant