自作プラグイン/bgcolor.inc.php
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
** bgcolor.inc.php [#zd299569]
|RIGHT:100|LEFT:360|c
|~サマリ|ページの背景色・文字色変更プラグイン|
|~リビジョン|1.0|
|~対応バージョン|1.5.x|
|~投稿者|[[K]]|
|~投稿日|&new{2020-08-06 (木) 16:12:29};|
**概要 [#v4e2761c]
個別でページ全体の背景色と文字色を変更できるプラグイン。
提案→[[欲しいプラグイン/421]]
**ソース [#vdebe103]
-bgcolor.inc.php
<?php
function plugin_bgcolor_convert(){
$args = func_get_args();
$bg_r = hexdec(substr($args[0], 0, 2));
$bg_g = hexdec(substr($args[0], 2, 2));
$bg_b = hexdec(substr($args[0], 4, 2));
$bg_a = hexdec(substr($args[0], 6, 2));
$font_r = hexdec(substr($args[1], 0, 2));
$font_g = hexdec(substr($args[1], 2, 2));
$font_b = hexdec(substr($args[1], 4, 2));
$font_a = hexdec(substr($args[1], 6, 2));
if (empty(substr($args[0], 6, 2))){
$bg_a = "1";
}else{
$bg_a = $bg_a / 255;
}
if (empty(substr($args[1], 6, 2))){
$font_a = "1";
}else{
$font_a = $font_a / 255;
}
if ($args == null){
$string = <<<EOD
<p>使い方が正しくありません。RGBA:#bgcolor(0...
EOD;
}else{
$string = <<<EOD
<style>
body{
background-color:rgba($bg_r, $bg_g, $bg_b, $bg_a);
color:rgba($font_r, $font_g, $font_b, $font_a);
}
</style>
EOD;
}
return $string;
}
?>
**使い方 [#d7a1b50b]
#bgcolor(背景の16進数カラーコード,文字の16進数カラーコー...
16進数カラーコードはRRGGBBAAやRRGGBBで設定してください。
***例 [#pf87b4c6]
#bgcolor(FFFFFF00,FF000064)
背景色が白で文字色が薄い赤となります。
**ライセンス [#c8e35ff0]
GPL
終了行:
** bgcolor.inc.php [#zd299569]
|RIGHT:100|LEFT:360|c
|~サマリ|ページの背景色・文字色変更プラグイン|
|~リビジョン|1.0|
|~対応バージョン|1.5.x|
|~投稿者|[[K]]|
|~投稿日|&new{2020-08-06 (木) 16:12:29};|
**概要 [#v4e2761c]
個別でページ全体の背景色と文字色を変更できるプラグイン。
提案→[[欲しいプラグイン/421]]
**ソース [#vdebe103]
-bgcolor.inc.php
<?php
function plugin_bgcolor_convert(){
$args = func_get_args();
$bg_r = hexdec(substr($args[0], 0, 2));
$bg_g = hexdec(substr($args[0], 2, 2));
$bg_b = hexdec(substr($args[0], 4, 2));
$bg_a = hexdec(substr($args[0], 6, 2));
$font_r = hexdec(substr($args[1], 0, 2));
$font_g = hexdec(substr($args[1], 2, 2));
$font_b = hexdec(substr($args[1], 4, 2));
$font_a = hexdec(substr($args[1], 6, 2));
if (empty(substr($args[0], 6, 2))){
$bg_a = "1";
}else{
$bg_a = $bg_a / 255;
}
if (empty(substr($args[1], 6, 2))){
$font_a = "1";
}else{
$font_a = $font_a / 255;
}
if ($args == null){
$string = <<<EOD
<p>使い方が正しくありません。RGBA:#bgcolor(0...
EOD;
}else{
$string = <<<EOD
<style>
body{
background-color:rgba($bg_r, $bg_g, $bg_b, $bg_a);
color:rgba($font_r, $font_g, $font_b, $font_a);
}
</style>
EOD;
}
return $string;
}
?>
**使い方 [#d7a1b50b]
#bgcolor(背景の16進数カラーコード,文字の16進数カラーコー...
16進数カラーコードはRRGGBBAAやRRGGBBで設定してください。
***例 [#pf87b4c6]
#bgcolor(FFFFFF00,FF000064)
背景色が白で文字色が薄い赤となります。
**ライセンス [#c8e35ff0]
GPL
ページ名: