test-page-twitter-css
ツイキャス用のコメント欄オーバーレイの『ツイッター風カスタムCSS』を試作中。。
ツイッター風のカスタムCSS
/* 絵文字フォントの読み込み */
@font-face {
font-family: 'Noto Color Emoji';
src: url(https://raw.githack.com/googlefonts/noto-emoji/main/fonts/NotoColorEmoji.ttf);
}
body {
font-family: 'Hiragino Kaku Gothic ProN','Hiragino Sans','メイリオ','Meiryo',system-ui,-apple-system,BlinkMacSystemFont,sans-serif,'Noto Color Emoji' !important;
}
body, #comment-list.app, .tw-comment-list-view__scroller {
overflow: visible !important; /* 水平スクロールバーを表示させない設定 */
}
.tw-comment-window-page {
padding: 0 !important;
}
@keyframes entry { /* アニメーションのフレーム設定 */
0% { left: 100%; max-height: 0px; opacity: 0.0; }
96% { left: -5%; max-height: 50px; opacity: 0.8; }
98% { left: 0%; max-height: 300px; opacity: 0.9; }
100% { left: 0%; max-height: 1000px; opacity: 1.0; }
}
.tw-comment-list-view__scroller >div {
padding-left: 5%;
}
body[data-is-embedded=true] .tw-comment-item {
background-color: #fff !important; /* 背景色 */
border-bottom: 1px solid #666; /* 区切り線 */
padding: 1em 0 !important;
/* アニメーション用の設定 */
animation-name: entry;
animation-duration: 1s;
animation-fill-mode: both;
animation-timing-function: ease-out;
max-height: 0px;
}
.tw-comment-item-comment br {
display: block !important; /* コメント内の改行の有効化 */
}
body .tw-comment-item-body {
text-shadow:none !important; /* テキストの影を無効化 */
}
/* アイコン */
.tw-comment-item-icon {
display: unset !important;
margin-top: 5px;
margin-right: 1em;
}
.tw-comment-item-icon img{
height: 64px;
width: 64px;
border-radius: 50%;
}
/* ユーザー名 */
a.tw-comment-item-name:link,
a.tw-comment-item-name:visited,
a.tw-comment-item-name:hover,
a.tw-comment-item-name:active {
color: #000 !important;
}
.tw-comment-item-name {
font-size: 12px !important;
font-weight: 900 !important;
}
/* ユーザーID */
.tw-comment-item-screen-id {
display: unset !important;
color: #666;
}
/* サポートの星 */
.tw-comment-item-star {
display: unset !important;
}
/* コメント */
.tw-comment-item-comment {
color: #000 !important;
}
/* タイムスタンプ */
.tw-comment-item-date {
display: block !important;
color: #666;
}
.tw-comment-item-date::before {
content: ' ';
padding: 0 8px;
background-position: center;
background-repeat: no-repeat;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M14.046 2.242l-4.148-.01h-.002c-4.374 0-7.8 3.427-7.8 7.802 0 4.098 3.186 7.206 7.465 7.37v3.828c0 .108.044.286.12.403.142.225.384.347.632.347.138 0 .277-.038.402-.118.264-.168 6.473-4.14 8.088-5.506 1.902-1.61 3.04-3.97 3.043-6.312v-.017c-.006-4.367-3.43-7.787-7.8-7.788zm3.787 12.972c-1.134.96-4.862 3.405-6.772 4.643V16.67c0-.414-.335-.75-.75-.75h-.396c-3.66 0-6.318-2.476-6.318-5.886 0-3.534 2.768-6.302 6.3-6.302l4.147.01h.002c3.532 0 6.3 2.766 6.302 6.296-.003 1.91-.942 3.844-2.514 5.176z' fill='%23666' /%3E%3C/svg%3E");
}
.tw-comment-item-date::after {
content: '';
padding: 0 160px;
background-position: center;
background-repeat: no-repeat;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E
%3Cpath d='M23.77 15.67c-.292-.293-.767-.293-1.06 0l-2.22 2.22V7.65c0-2.068-1.683-3.75-3.75-3.75h-5.85c-.414 0-.75.336-.75.75s.336.75.75.75h5.85c1.24 0 2.25 1.01 2.25 2.25v10.24l-2.22-2.22c-.293-.293-.768-.293-1.06 0s-.294.768 0 1.06l3.5 3.5c.145.147.337.22.53.22s.383-.072.53-.22l3.5-3.5c.294-.292.294-.767 0-1.06z m-10.66 3.28H7.26c-1.24 0-2.25-1.01-2.25-2.25V6.46l2.22 2.22c.148.147.34.22.532.22s.384-.073.53-.22c.293-.293.293-.768 0-1.06l-3.5-3.5c-.293-.294-.768-.294-1.06 0l-3.5 3.5c-.294.292-.294.767 0 1.06s.767.293 1.06 0l2.22-2.22V16.7c0 2.068 1.683 3.75 3.75 3.75h5.85c.414 0 .75-.336.75-.75s-.337-.75-.75-.75z' fill='%23666' /%3E
%3C/svg%3E"),
url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E
%3Cpath transform='translate(96, 0)' d='M12 21.638h-.014C9.403 21.59 1.95 14.856 1.95 8.478c0-3.064 2.525-5.754 5.403-5.754 2.29 0 3.83 1.58 4.646 2.73.814-1.148 2.354-2.73 4.645-2.73 2.88 0 5.404 2.69 5.404 5.755 0 6.376-7.454 13.11-10.037 13.157H12z M7.354 4.225c-2.08 0-3.903 1.988-3.903 4.255 0 5.74 7.034 11.596 8.55 11.658 1.518-.062 8.55-5.917 8.55-11.658 0-2.267-1.823-4.255-3.903-4.255-2.528 0-3.94 2.936-3.952 2.965-.23.562-1.156.562-1.387 0-.014-.03-1.425-2.965-3.954-2.965z' fill='%23666' /%3E
%3C/svg%3E"),
url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E
%3Cg transform='translate(96, 0)'%3E
%3Cpath d='M17.53 7.47l-5-5c-.293-.293-.768-.293-1.06 0l-5 5c-.294.293-.294.768 0 1.06s.767.294 1.06 0l3.72-3.72V15c0 .414.336.75.75.75s.75-.336.75-.75V4.81l3.72 3.72c.146.147.338.22.53.22s.384-.072.53-.22c.293-.293.293-.767 0-1.06z' fill='%23666' /%3E
%3Cpath d='M19.708 21.944H4.292C3.028 21.944 2 20.916 2 19.652V14c0-.414.336-.75.75-.75s.75.336.75.75v5.652c0 .437.355.792.792.792h15.416c.437 0 .792-.355.792-.792V14c0-.414.336-.75.75-.75s.75.336.75.75v5.652c0 1.264-1.028 2.292-2.292 2.292z' fill='%23666' /%3E
%3C/g%3E
%3C/svg%3E"),
url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E
%3Cpath transform='translate(96, 0)' d='M19.25 3.018H4.75C3.233 3.018 2 4.252 2 5.77v12.495c0 1.518 1.233 2.753 2.75 2.753h14.5c1.517 0 2.75-1.235 2.75-2.753V5.77c0-1.518-1.233-2.752-2.75-2.752zm-14.5 1.5h14.5c.69 0 1.25.56 1.25 1.25v.714l-8.05 5.367c-.273.18-.626.182-.9-.002L3.5 6.482v-.714c0-.69.56-1.25 1.25-1.25zm14.5 14.998H4.75c-.69 0-1.25-.56-1.25-1.25V8.24l7.24 4.83c.383.256.822.384 1.26.384.44 0 .877-.128 1.26-.383l7.24-4.83v10.022c0 .69-.56 1.25-1.25 1.25z' fill='%23666' /%3E
%3C/svg%3E");
}
設定
: 下の設定はブラウザに一定期間保存される設定になっていますが、左のリセットボタンで既定値に初期化出来ます。
アニメーション効果:
色:
コメント欄サンプル
下は配色を確認する為のサンプル表示になります。 (上の設定を変更するとサンプルの表示が更新されます。)
アニメーション効果は反映されないのと、実際に表示されるパーツのサイズや位置は『コメ欄』や、OBSなどの実際に使う環境内で確認して下さい。
フッター
スクショで画像にとして保存した後、コメント欄の下に貼り付けてサイズを上手く調節出来ればそれっぽく見えるかと。
改善点
- ✅ダークモ―ド?
- ✅リツイート ()、 ライク ()、 シェア () のアイコンをどうにかうまく追加したい…
- タイムスタンプを日付だけの表示の変更、又は何分前、何時間前の表示に変更するのはCSSだけでは難しい…
- タイムスタンプの表示位置をユーザーIDの左に移動するのはCSSだけでは難しい…