@s7[ICube plugin for DokuWiki]
@center[by Láng Attila D.]
ICube, based on a script by [[http://software.rubikscube.info/icube|Josef Jelinek]], is a DokuWiki plugin to display static images of Rubik’s cubes of any size. Its possibilities are greatly enhanced.
@s6[Features]
* cubes of any size, 1·1·1, 2·2·2, 3·3·3, 4·4·4 etc.
* any image size with any background color
* any color of “plastic”, set individually for each side (what’s not possible on a real cube) or each side can be hidden
* each facelet can be painted in a set of predefined colors
* each facelet can be marked by one or more symbols, in a set of colors
* redefinable colors, up to 26 for each cube
* mirroring either or both vertically and horizontally
* configurable size of “stickers”
* configurable distance of “stickers” from the “plastic”
* each image is created by a single command
* image alignment
* serial images
@s6[The Command]
To add a cube image to your page, enter
''`{`{cube ''//parameters//''`}`}''
Leave a space after the word ''cube''. //Parameters// specify everything about the image. They’re separated by spaces. Each parameter is a word followed by an equal sign ''='' and a value. For some parameters, no value and no equal sign is is needed, but if it’s present it won’t count.
@s5[Image Alignment]
To align the image to the left, add a space before the closing braces. To align it to the right, add a space after the opening braces. To center the image, add a space to both places.
''`{`{cube left-aligned `}`}''
''`{`{ cube right-aligned`}`}''
''`{`{ cube centered `}`}''
@s6[Parameters]
@s5[SIZE]
To set the size of the cube, use ''size''. The default is 3, meaning a 3·3·3 cube.
{{cube size=1 map=rgb}} ''size=1''
{{cube size=2 map=wrrw-boob-yggy}} ''size=2''
{{cube size=3 map=wwwbbbrrr-bwrbwrbwr-wgrwgrwgr}} ''size=3''
{{cube size=4 map=wrwrrwrwwrwrrwrw-gggggyyggyyggggg-rygbygbrgbrybryg}} ''size=4''
{{cube size=5 map=roygb-oygbc-ygbcm-gbcmp-bcmpw|cmpwr-mpwro-pwroy-wroyg-roygb|oygbc-ygbcm-gbcmp-bcmpw-cmpwr}} ''size=5''
{{cube size=10 map=rrrrrrrrrr-oooooooooo-yyyyyyyyyy-gggggggggg-cccccccccc-bbbbbbbbbb-mmmmmmmmmm-pppppppppp-dddddddddd-wwwwwwwwww|rrrrrrrrrr-oooooooooo-yyyyyyyyyy-gggggggggg-cccccccccc-bbbbbbbbbb-mmmmmmmmmm-pppppppppp-dddddddddd-wwwwwwwwww|rrrrrrrrrr-oooooooooo-yyyyyyyyyy-gggggggggg-cccccccccc-bbbbbbbbbb-mmmmmmmmmm-pppppppppp-dddddddddd-wwwwwwwwww}} ''size=10''
@s5[IMGSIZE]
To set the size of the image, use ''imgsize''. The default is 100 pixels (like the images shown above). Images are square so only one number is needed.
{{cube imgsize=300 size=10 map=rrrrrrrrrr-oooooooooo-yyyyyyyyyy-gggggggggg-cccccccccc-bbbbbbbbbb-mmmmmmmmmm-pppppppppp-dddddddddd-wwwwwwwwww|rrrrrrrrrr-oooooooooo-yyyyyyyyyy-gggggggggg-cccccccccc-bbbbbbbbbb-mmmmmmmmmm-pppppppppp-dddddddddd-wwwwwwwwww|rrrrrrrrrr-oooooooooo-yyyyyyyyyy-gggggggggg-cccccccccc-bbbbbbbbbb-mmmmmmmmmm-pppppppppp-dddddddddd-wwwwwwwwww}} ''imgsize=300''
{{cube imgsize=500 size=10 map=rrrrrrrrrr-oooooooooo-yyyyyyyyyy-gggggggggg-cccccccccc-bbbbbbbbbb-mmmmmmmmmm-pppppppppp-dddddddddd-wwwwwwwwww|rrrrrrrrrr-oooooooooo-yyyyyyyyyy-gggggggggg-cccccccccc-bbbbbbbbbb-mmmmmmmmmm-pppppppppp-dddddddddd-wwwwwwwwww|rrrrrrrrrr-oooooooooo-yyyyyyyyyy-gggggggggg-cccccccccc-bbbbbbbbbb-mmmmmmmmmm-pppppppppp-dddddddddd-wwwwwwwwww}} ''imgsize=500''
@s5[BORDER]
To set the size of the border around “stickers”, use ''border''. Default value is 25 (like the images shown above).
{{cube border=5 imgsize=300 size=10 map=rrrrrrrrrr-oooooooooo-yyyyyyyyyy-gggggggggg-cccccccccc-bbbbbbbbbb-mmmmmmmmmm-pppppppppp-dddddddddd-wwwwwwwwww|rrrrrrrrrr-oooooooooo-yyyyyyyyyy-gggggggggg-cccccccccc-bbbbbbbbbb-mmmmmmmmmm-pppppppppp-dddddddddd-wwwwwwwwww|rrrrrrrrrr-oooooooooo-yyyyyyyyyy-gggggggggg-cccccccccc-bbbbbbbbbb-mmmmmmmmmm-pppppppppp-dddddddddd-wwwwwwwwww}} ''border=5''
{{cube border=0 imgsize=300 size=10 map=rrrrrrrrrr-oooooooooo-yyyyyyyyyy-gggggggggg-cccccccccc-bbbbbbbbbb-mmmmmmmmmm-pppppppppp-dddddddddd-wwwwwwwwww|rrrrrrrrrr-oooooooooo-yyyyyyyyyy-gggggggggg-cccccccccc-bbbbbbbbbb-mmmmmmmmmm-pppppppppp-dddddddddd-wwwwwwwwww|rrrrrrrrrr-oooooooooo-yyyyyyyyyy-gggggggggg-cccccccccc-bbbbbbbbbb-mmmmmmmmmm-pppppppppp-dddddddddd-wwwwwwwwww}} ''border=0''
@s5[DIST]
To move the “stickers” away from the “plastic”, use ''dist''. Default value is 5 (like the images shown above).
{{cube imgsize=300 size=5 dist=100 map=roygb-oygbc-ygbcm-gbcmp-bcmpw|cmpwr-mpwro-pwroy-wroyg-roygb|oygbc-ygbcm-gbcmp-bcmpw-cmpwr}} ''dist=100''
{{cube imgsize=300 size=5 dist=0 border=0 map=roygb-oygbc-ygbcm-gbcmp-bcmpw|cmpwr-mpwro-pwroy-wroyg-roygb|oygbc-ygbcm-gbcmp-bcmpw-cmpwr}} ''dist=0 border=0''
@s5[MIRROR]
To mirror the image, use either ''mirror=x'', ''mirror=y'' or ''mirror=xy''. Note that the facelets are painted in the same order, before applying the mirroring.
{{cube size=3 imgsize=200 mirror=x map=wwwbbbrrr-bwrbwrbwr-wgrwgrwgr}} ''mirror=x''
{{cube size=3 imgsize=200 mirror=y map=wwwbbbrrr-bwrbwrbwr-wgrwgrwgr}} ''mirror=y''
{{cube size=3 imgsize=200 mirror=xy map=wwwbbbrrr-bwrbwrbwr-wgrwgrwgr}} ''mirror=xy''
@s5[BACK]
To set the background of the image, use ''back''. The value is a hexadecimal RGB code. It can be eight characters long, where the last two ones are for transparency, from 00 (totally transparent) to 7F (to totally oblique). The default is white.
{{cube size=3 imgsize=200 back=c06000 map=wwwbbbrrr-bwrbwrbwr-wgrwgrwgr}} ''back=c06000''
@s5[USIDE, FSIDE, RSIDE]
To set the color of the “plastic” on either side of the cube, use ''uside'' for the upper side, ''fside'' for the front side or ''rside'' for the right side. The value for each is a color letter (see MAP). The default is ''k'' (black). Note that mirroring is applied after creating the complete cube, so which side is which will be unaffected.
Coloring the sides differently will result in funny looking cubes since this is not possible on real cubes.
{{cube size=3 imgsize=200 uside=y fside=o rside=c map=wwwbbbrrr-bwrbwrbwr-wgrwgrwgr}} ''uside=y fside=o rside=c''
@s5[UHIDE, FHIDE, RHIDE]
To hide the “plastic” on either side of the cube, use ''uhide'' for the upper side, ''fhide'' for the front side or ''rhide'' for the right side. There is no value for these parameters; entering the word will hide the side.
{{cube size=3 imgsize=200 back=c06000 uhide fhide rhide border=50 dist=50 map=wwwbbbrrr-bwrbwrbwr-wgrwgrwgr}} ''uhide fhide rhide''
@s5[MAP]
The ''map'' parameter creates the actual color map of facelets. The value for this parameter is a description where each letter or symbol has a meaning. The description is read letter by letter and each character is applied to a facelet, in the following order:
{{cube size=3 imgsize=400 map=rrroooyyy-gggcccbbb-pppmmmwww}}
First, the upper side, left to right, top to bottom (red, orange, yellow). Second, the front side, similarly (green, light blue, dark blue). Third, the right side (pink, magenta, white).
There are three groups of symbols: colors, separators and markers.
@s4[Color Letters]
Each letter of the following set represents a color. These are all lowercase.
| ''r'' |red|
| ''o'' |orange|
| ''b'' |blue|
| ''g'' |green|
| ''w'' |white|
| ''y'' |yellow|
| ''l'' |light grey|
| ''d'' |dark grey|
| ''x'' |middle grey|
| ''k'' |black|
| ''c'' |cyan|
| ''p'' |pink|
| ''m'' |magenta|
| ''n'' |brown|
| ''i'' |lime|
| ''_'' |transparent|
The following cube shows all the colors in the same order as in the table. Note that the “plastic” is hidden on all three sides, so the ''_'' facelet is transparent (at the bottom left corner of the front side). The example also shows that if the description is not long enough the additional facelets are shown as a “missing” mark, a white X bordered by grey.
{{cube size=3 imgsize=400 map=robgwyldx-kcpmni_ back=004000 fhide uhide rhide}} ''map=rob-gwy-ldx|kcp-mni_''
@s4[Separators]
The characters ''-'' and ''|'' are not processed at all. They can be used to separate rows of facelets and/or sides. The description of the last cube ''map=rob-gwy-ldx|kcp-m_'' uses ''-'' to separate rows and ''|'' for sides, but you decide which on to use and where. You can also completely avoid using them if you wish.
@s4[Markers]
A color letter may be followed one or more markers. A marker is two characters: the first one selects the marker and the second one tells the color is the marker. Markers are the following (note that letters are uppercase):
| ''X'' |X mark|
| ''!'' |square|
| ''\'' |\ line|
| ''/'' |/ line|
| ''L'' |left pointing triangle, filled|
| ''R'' |right pointing triangle, filled|
| ''U'' |upwards pointing triangle, filled|
| ''D'' |downwards pointing triangle, filled|
| ''N'' |diamond, filled|
| ''<'' |left pointing triangle, hollow|
| ''>'' |right pointing triangle, hollow|
| ''^'' |upwards pointing triangle, hollow|
| ''V'' |downwards pointing triangle, hollow|
| ''M'' |diamond, hollow|
{{cube size=2 imgsize=400 map=dXrd!od\yd/gdLcdRbdUmdDpdNldrd^g draw map=dVcdMb}}
These cubes are drawn by the following descriptions: ''dXrd!od\yd/gdLcdRbdUmdDpdNldrd^g'' and ''dVcdMb''.
''dXr'' – a middle grey (''d'') facelet with an X in red (''r'')
''d!o'' – grey facelet with a square in orange (''o'')
''d\y'' – grey facelet with a \ line in yellow (''y'')
and so on.
Any number of markers can be applied to the same facelet. They’re drawn in the specified order, covering previously drawn ones.
{{cube size=1 imgsize=400 dist=0 border=0 map=p!rXgNdMy-r!yLbRcXw-g!wUoDy\r/b}}
''`{`{cube size=1 imgsize=400 dist=0 border=0 map=p!rXgNdMy-r!yLbRcXw-g!wUoDy\r/b`}`}''
@s5[COLOR]
If the predefined set of 15 colors is not enough you can define your own, up to 26 for each command. This is done by the ''color'' command. Actually, its name is ''colora'', ''colorb'', ''colorc'' and so on, thru ''colorz''. The parameter is a hexadecimal RGB color.
{{cube size=3 map=wwwbbbrrr-bwrbwrbwr-wgrwgrwgr colorw=a0ff00}} ''colorw=a0ff00''
@s5[DRAW]
If you want to display several cubes in a row, you needn’t to copy and paste the complete description for each one. Instead, you can use ''draw''. It will display the cube immediately, and you can add changes to the cube and display it with another ''draw'' or with the end of the command. Don’t apply ''draw'' at the end of the ''`{`{cube`}`}'' command.
You can add a text to ''draw'' to be displayed between the two images. Wiki markup won’t work; HTML code will. To include a space, use a double underscore ''__'' instead.
{{cube size=3 map=gggUrgggUrgggUr-wwwUrwwwUrwwwUr-ooooooooo draw map=ggwggwggw-wwbwLrwLrbLrwwb-ooooLroLroLrooo draw map=ggwgLrgLrwLrggw-wwbooowwb-ooUrogyUryooUro draw map=ggwoyoggw-wwbooowwb-oyogbyobo}}
''`{`{cube size=3 map=gggUrgggUrgggUr-wwwUrwwwUrwwwUr-ooooooooo draw map=ggwggwggw-wwbwLrwLrbLrwwb-ooooLroLroLrooo draw map=ggwgLrgLrwLrggw-wwbooowwb-ooUrogyUryooUro draw map=ggwoyoggw-wwbooowwb-oyogbyobo`}`}''
{{cube size=3 map=ooooooooo-wwwwwwwww-bbbbbbbbb draw colorw=87ceeb draw=
coloro=dda0dd draw colorb=808000}}
''`{`{cube size=3 map=ooooooooo-wwwwwwwww-bbbbbbbbb draw colorw=87ceeb draw=
coloro=dda0dd draw colorb=808000`}`}''
@s6[To Do List]
* markers:
* circle and filled circle
* center lines, horizontal and vertical
* letter markers
* circular arrows
* the three other sides, projected or extended
* 2D rotation
* subtitles