ダークモード対応絵文字を作る
/nishio/ダークモード対応絵文字を作る
まだ便利なツールはないようなので
svg-hosting.vercel.app を使えば簡単にできます
コードブロック記法に書いたsvgを表示する
https://svg-hosting.vercel.app/api/svg?url=https://scrapbox.io/api/code/villagepump/ダークモード対応絵文字を作る/yatta01.svg
文字に白い枠をつけているのか、なるほどyosider.iconU.icontakker.icon
/icons2 に置いておいたほうがいいかな? suto3.icon
/iconsでもいいですよtakker.icon
これって、prefers-color-schemeを使えば自動でdark themeとlight themeが切り換わるようになるのでは?takker.icon
切り換わるようにしてみたsuto3.icon
https://svg-hosting.vercel.app/api/svg?url=https://scrapbox.io/api/code/villagepump/ダークモード対応絵文字を作る/yatta02.svg
あまり意味がないような…(白黒が入れ替わる)
code:yatta01.svg
<svg width="100" height="100" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
<g>
<rect x="5" y="5" width="90" height="90" rx="15" ry="15"
fill-opacity="0" stroke="white" stroke-width="2" />
<rect x="8" y="8" width="84" height="84" rx="10" ry="10"
fill-opacity="0" stroke="#333" stroke-width="3" />
<text x="10" y="48" font-size="45" stroke="white" stroke-width="2" fill="#333"
font-weight="900" letter-spacing="0" word-spacing="0" >
や
</text>
<text x="28" y="58" font-size="35" stroke="white" stroke-width="2" fill="#333"
font-weight="900" letter-spacing="0" word-spacing="0" >
っ
</text>
<text x="45" y="88" font-size="45" stroke="white" stroke-width="2" fill="#333"
font-weight="900" letter-spacing="0" word-spacing="0" >
た
</text>
</g>
</svg>
code:yatta02.svg
<svg width="100" height="100" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
<g>
<style type="text/css">
#tx01{
fill: white;
stroke: #333;
stroke-width:2;
font-weight:900;
}
#f01{
stroke: #333;
stroke-width: 2;
fill-opacity: 0;
}
#f02{
stroke: white;
stroke-width: 2;
fill-opacity: 0;
}
@media (prefers-color-scheme: light) { /* */
/*@media (prefers-color-scheme: dark) { /* */
#tx01{
fill:#333;
stroke:white;
}
#f01{
stroke: #333;
}
#f02{
stroke: white;
}
}
</style>
<rect id="f01" x="5" y="5" width="90" height="90" rx="12" ry="12" />
<rect id="f02" x="7" y="7" width="86" height="86" rx="10" ry="10" />
<text id="tx01" x="10" y="48" font-size="45" letter-spacing="0" word-spacing="0" >
や
</text>
<text id="tx01" x="28" y="58" font-size="35" letter-spacing="0" word-spacing="0" >
っ
</text>
<text id="tx01" x="45" y="88" font-size="45" letter-spacing="0" word-spacing="0" >
た
</text>
}
</g>
</svg>
#dark_theme
#アイコン #絵文字