ICube, based on a script by Josef Jelinek, is a DokuWiki plugin to display static images of Rubik’s cubes of any size. Its possibilities are greatly enhanced.
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.
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 }}
To set the size of the cube, use size
. The default is 3, meaning a 3·3·3 cube.
size=1
size=2
size=3
size=4
size=5
size=10
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.
imgsize=300
imgsize=500
To set the size of the border around “stickers”, use border
. Default value is 25 (like the images shown above).
border=5
border=0
To move the “stickers” away from the “plastic”, use dist
. Default value is 5 (like the images shown above).
dist=100
dist=0 border=0
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.
mirror=x
mirror=y
mirror=xy
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.
back=c06000
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.
uside=y fside=o rside=c
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.
uhide fhide rhide
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:
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.
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.
map=rob-gwy-ldx|kcp-mni_
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.
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 |
These cubes are drawn by the following descriptions: dXrd!od\yd/gdLcdRbdUmdDpdNld<yd>rd^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}}
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.
colorw=a0ff00
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=ooooooooo-wwwwwwwww-bbbbbbbbb draw colorw=87ceeb draw=<br> coloro=dda0dd draw colorb=808000}}