「なでしこ」でカラーネームを使う(続)
昨日は、色定数を拡張する方法を試してみたのだが、色の名前を毎回定義するのはちょっと大変だ。「サクラ」で使っているGMの音色名のように、定義ファイルを予め作っておき、これをIncludeできるようにすれば、定数を簡単に使うことができる。
「なでしこ」で、これと同じことをやるには、Include命令に相当する「取り込む」命令を使えば良い。
取り込む
http://nadesi.com/doc/cmd/doc.cgi?mode=cmd&id=189
それでは、早速この機能を使ってみることにする。まずは、下のプログラムを「色定数.nako」という名前で保存する。
//色定数
!Black =$000000
!Dimgray =$696969
!Gray =$808080
!Darkgray =$A9A9A9
!Silver =$C0C0C0
!Lightgrey =$D3D3D3
!Gainsboro =$DCDCDC
!Whitesmoke =$F5F5F5
!White =$FFFFFF
!Snow =$FFFAFA
!Ghostwhite =$F8F8FF
!Floralwhite =$FFFAF0
!Seashell =$FFF5EE
!Ivory =$FFFFF0
!Oldlace =$FDF5E6
!Linen =$FAF0E6
!Lavenderblush =$FFF0F5
!Mistyrose =$FFE4E1
!Antiquewhite =$FAEBD7
!Papayawhip =$FFEFD5
!Blanchedalmond =$FFEBCD
!Bisque =$FFE4C4
!Moccasin =$FFE4B5
!Navajowhite =$FFDEAD
!Peachpuff =$FFDAB9
!Pink =$FFC0CB
!Lightpink =$FFB6C1
!Hotpink =$FF69B4
!Deeppink =$FF1493
!Crimson =$DC143C
!Red =$FF0000
!Orangered =$FF4500
!Tomato =$FF6347
!Coral =$FF7F50
!LightCoral =$F08080
!Lightsalmon =$FFA07A
!Salmon =$FA8072
!Darksalmon =$E9967A
!RosyBrown =$BC8F8F
!Indianred =$CD5C5C
!FireBrick =$B22222
!Brown =$A52A2A
!Darkred =$8B0000
!Maroon =$800000
!Saddlebrown =$8B4513
!Sienna =$A0522D
!DarkGoldenrod =$B8860B
!Chocolate =$D2691E
!Peru =$CD853F
!Goldenrod =$DAA520
!Darkorange =$FF8C00
!Sandybrown =$F4A460
!Orange =$FFA500
!Gold =$FFD700
!Yellow =$FFFF00
!Khaki =$F0E68C
!Palegoldenrod =$EEE8AA
!Beige =$F5F5DC
!Cornsilk =$FFF8DC
!Lightyellow =$FFFFE0
!Lightgoldenrodyellow=$FAFAD2
!Lemonchiffon =$FFFACD
!Wheat =$F5DEB3
!Burlywood =$DEB887
!Tan =$D2B48C
!Slategray =$708090
!Lightslategray =$778899
!Lightsteelblue =$80C4DE
!Steelblue =$4682B4
!Royalblue =$4169E1
!Darkkhaki =$BDB76B
!Olive =$808000
!Olivedrab =$6B8E23
!Yellowgreen =$9ACD32
!Limegreen =$32CD32
!Lime =$00FF00
!Lawngreen =$7CFC00
!Chartreuse =$7FFF00
!Greenyellow =$ADFF2F
!Springgreen =$00FF7F
!Mediumspringgreen =$00FA9A
!Aquamarine =$7FFFD4
!Mediumaquamarine =$66CDAA
!Palegreen =$98FB98
!LightGreen =$90EE90
!Mediumseagreen =$3CB371
!Darkseagreen =$8FBC8F
!Forestgreen =$228B22
!Green =$008000
!Darkgreen =$006400
!Darkolivegreen =$556B2F
!Seagreen =$2E8B57
!DarkSlategray =$2F4F4F
!Teal =$008080
!Darkcyan =$008B8B
!Cadetblue =$5F9EA0
!Lightseagreen =$20B2AA
!Darkturquoise =$00CED1
!Mediumturquoise =$48D1CC
!Turquoise =$40E0D0
!Aqua =$00FFFF
!Cyan =$00FFFF
!LightCyan =$E0FFFF
!HoneyDew =$F0FFF0
!Mintcream =$F5FFFA
!Azure =$F0FFFF
!Aliceblue =$F0F8FF
!Lavender =$E6E6FA
!Paleturquoise =$AFEEEE
!Powderblue =$B0E0E6
!Lightblue =$ADD8E6
!Skyblue =$87CEFA
!Lightskyblue =$87CEEB
!Deepskyblue =$00BFFF
!Dodgerblue =$1E90FF
!Cornflowerblue =$6495ED
!Mediumslateblue =$7B68EE
!Slateblue =$6A5ACD
!Mediumpurple =$9370DB
!Blueviolet =$8A2BE2
!Darkslateblue =$483D8B
!Indigo =$4B0082
!Purple =$800080
!Darkmagenta =$8B008B
!Darkviolet =$9400D3
!Darkorchid =$9932CC
!Mediumorchid =$BA55D3
!Orchid =$DA70D6
!Plum =$DDA0DD
!Thistle =$D8BFD8
!Violet =$EE82EE
!Fuchsia =$FF00FF
!Magenta =$FF00FF
!Mediumvioletred =$C71585
!Palevioletred =$DB7093
!Blue =$0000FF
!Mediumblue =$0000CD
!Darkblue =$00008B
!Navy =$000080
!Midnightblue =$191970
//ここまで
これが出来てしまえば、後は、プログラムで次のように書いておけば、HTMLと同じ色定数が使えるようになる。
!"色定数.nako"を取り込む
0 Comments:
コメントを投稿
<< Home