How to add color to Editor dropdown menu?

Started by Kimmen, April 12, 2013, 06:06:02 AM

Previous topic - Next topic

Kimmen

Hello, did alot of searching for this and have made the following steps:

In Editor.js

// Color maps! (hex => name)
this.oFontColors = {
black: '#000000',
blizzblue: '#33A7FF',
red: '#ff0000',
yellow: '#ffff00',
pink: '#ffc0cb',
green: '#008000',
orange: '#ffa500',
purple: '#800080',
blue: '#0000ff',
beige: '#f5f5dc',
brown: '#a52a2a',
teal: '#008080',
navy: '#000080',
maroon: '#800000',
limegreen: '#32cd32',

}


In GenericControls.template.php:
// Print a drop down list for all the colors we allow!
if (!isset($context['disabled_tags']['color']))
echo ',
{
sType: \'select\',
sName: \'sel_color\',
oOptions: {
\'\': ', JavaScriptEscape($txt['change_color']), ',
\'black\': ', JavaScriptEscape($txt['black']), ',
\'#33A7FF\': ', JavaScriptEscape($txt['blizzblue]), ',
\'red\': ', JavaScriptEscape($txt['red']), ',
\'yellow\': ', JavaScriptEscape($txt['yellow']), ',
\'pink\': ', JavaScriptEscape($txt['pink']), ',
\'green\': ', JavaScriptEscape($txt['green']), ',
\'orange\': ', JavaScriptEscape($txt['orange']), ',
\'purple\': ', JavaScriptEscape($txt['purple']), ',
\'blue\': ', JavaScriptEscape($txt['blue']), ',
\'beige\': ', JavaScriptEscape($txt['beige']), ',
\'brown\': ', JavaScriptEscape($txt['brown']), ',
\'teal\': ', JavaScriptEscape($txt['teal']), ',
\'navy\': ', JavaScriptEscape($txt['navy']), ',
\'maroon\': ', JavaScriptEscape($txt['maroon']), ',
\'limegreen\': ', JavaScriptEscape($txt['lime_green']), ',
\'white\': ', JavaScriptEscape($txt['white']), ',
}
}';


In Post.english.php:
$txt['change_color'] = 'Change Color';
$txt['black'] = 'Black';
$txt['#33A7FF'] = 'blizzblue';
$txt['red'] = 'Red';
$txt['yellow'] = 'Yellow';
$txt['pink'] = 'Pink';
$txt['green'] = 'Green';
$txt['orange'] = 'Orange';
$txt['purple'] = 'Purple';
$txt['blue'] = 'Blue';
$txt['beige'] = 'Beige';
$txt['brown'] = 'Brown';
$txt['teal'] = 'Teal';
$txt['navy'] = 'Navy';
$txt['maroon'] = 'Maroon';
$txt['lime_green'] = 'Lime Green';
$txt['white'] = 'White';


So, i manage to add the color, but the name blizzblue does not appear, just a empty line, like this:


How do i make blizzblue name appear with the color is picked for the name?

Edit: i also get this error message in the error log:
http://www.efclan.eu/index.php?action=post;topic=1289.0;last_msg=41458: Undefined index: blizzblueFile: /customers/4/6/0/efclan.eu/httpd.www/Themes/default/GenericControls.template.php
Line: 193

Badboy

In GenericControls.template.php

Code (FIND) Select
\'#33A7FF\': ', JavaScriptEscape($txt['blizzblue]), ',

Code (REPLACE) Select
\'blizzblue\': ', JavaScriptEscape($txt['blizzblue']), ',


In Post.english.php

Code (FIND) Select
$txt['#33A7FF'] = 'blizzblue';

Code (REPLACE) Select
$txt['blizzblue'] = 'blizzblue';
Nothing is true, everything is permitted.

Kimmen

After doing this, the name blizzblue appears in the dropdown menu, but it is missing the color. Look at image below:



Also, when i click on it, code inside editor looks like this:

[color=blizzblue][/color]


Kimmen

I finally found the solution !!! Thanks for pointing me in the correct direction Badboy..

Here is how to add color in SMF 2.0.X

In Editor.js

// Color maps! (hex => name)
this.oFontColors = {
black: '#000000',
blizzblue: '#33A7FF',
red: '#ff0000',
yellow: '#ffff00',
pink: '#ffc0cb',
green: '#008000',
orange: '#ffa500',
purple: '#800080',
blue: '#0000ff',
beige: '#f5f5dc',
brown: '#a52a2a',
teal: '#008080',
navy: '#000080',
maroon: '#800000',
limegreen: '#32cd32',

}


In GenericControls.template.php:
// Print a drop down list for all the colors we allow!
if (!isset($context['disabled_tags']['color']))
echo ',
{
sType: \'select\',
sName: \'sel_color\',
oOptions: {
\'\': ', JavaScriptEscape($txt['change_color']), ',
\'black\': ', JavaScriptEscape($txt['black']), ',
\'#33A7FF\': ', JavaScriptEscape($txt['blizzblue]), ',
\'red\': ', JavaScriptEscape($txt['red']), ',
\'yellow\': ', JavaScriptEscape($txt['yellow']), ',
\'pink\': ', JavaScriptEscape($txt['pink']), ',
\'green\': ', JavaScriptEscape($txt['green']), ',
\'orange\': ', JavaScriptEscape($txt['orange']), ',
\'purple\': ', JavaScriptEscape($txt['purple']), ',
\'blue\': ', JavaScriptEscape($txt['blue']), ',
\'beige\': ', JavaScriptEscape($txt['beige']), ',
\'brown\': ', JavaScriptEscape($txt['brown']), ',
\'teal\': ', JavaScriptEscape($txt['teal']), ',
\'navy\': ', JavaScriptEscape($txt['navy']), ',
\'maroon\': ', JavaScriptEscape($txt['maroon']), ',
\'limegreen\': ', JavaScriptEscape($txt['lime_green']), ',
\'white\': ', JavaScriptEscape($txt['white']), ',
}
}';


In Post.english.php:
$txt['change_color'] = 'Change Color';
$txt['black'] = 'Black';
$txt['blizzblue'] = 'blizzblue';
$txt['red'] = 'Red';
$txt['yellow'] = 'Yellow';
$txt['pink'] = 'Pink';
$txt['green'] = 'Green';
$txt['orange'] = 'Orange';
$txt['purple'] = 'Purple';
$txt['blue'] = 'Blue';
$txt['beige'] = 'Beige';
$txt['brown'] = 'Brown';
$txt['teal'] = 'Teal';
$txt['navy'] = 'Navy';
$txt['maroon'] = 'Maroon';
$txt['lime_green'] = 'Lime Green';
$txt['white'] = 'White';

Jeremy M.

Quote from: Kimmen on April 12, 2013, 06:58:26 AM
I finally found the solution !!! Thanks for pointing me in the correct direction Badboy..

Here is how to add color in SMF 2.0.X

In Editor.js

// Color maps! (hex => name)
this.oFontColors = {
black: '#000000',
blizzblue: '#33A7FF',
red: '#ff0000',
yellow: '#ffff00',
pink: '#ffc0cb',
green: '#008000',
orange: '#ffa500',
purple: '#800080',
blue: '#0000ff',
beige: '#f5f5dc',
brown: '#a52a2a',
teal: '#008080',
navy: '#000080',
maroon: '#800000',
limegreen: '#32cd32',

}


In GenericControls.template.php:
// Print a drop down list for all the colors we allow!
if (!isset($context['disabled_tags']['color']))
echo ',
{
sType: \'select\',
sName: \'sel_color\',
oOptions: {
\'\': ', JavaScriptEscape($txt['change_color']), ',
\'black\': ', JavaScriptEscape($txt['black']), ',
\'#33A7FF\': ', JavaScriptEscape($txt['blizzblue]), ',
\'red\': ', JavaScriptEscape($txt['red']), ',
\'yellow\': ', JavaScriptEscape($txt['yellow']), ',
\'pink\': ', JavaScriptEscape($txt['pink']), ',
\'green\': ', JavaScriptEscape($txt['green']), ',
\'orange\': ', JavaScriptEscape($txt['orange']), ',
\'purple\': ', JavaScriptEscape($txt['purple']), ',
\'blue\': ', JavaScriptEscape($txt['blue']), ',
\'beige\': ', JavaScriptEscape($txt['beige']), ',
\'brown\': ', JavaScriptEscape($txt['brown']), ',
\'teal\': ', JavaScriptEscape($txt['teal']), ',
\'navy\': ', JavaScriptEscape($txt['navy']), ',
\'maroon\': ', JavaScriptEscape($txt['maroon']), ',
\'limegreen\': ', JavaScriptEscape($txt['lime_green']), ',
\'white\': ', JavaScriptEscape($txt['white']), ',
}
}';


In Post.english.php:
$txt['change_color'] = 'Change Color';
$txt['black'] = 'Black';
$txt['blizzblue'] = 'blizzblue';
$txt['red'] = 'Red';
$txt['yellow'] = 'Yellow';
$txt['pink'] = 'Pink';
$txt['green'] = 'Green';
$txt['orange'] = 'Orange';
$txt['purple'] = 'Purple';
$txt['blue'] = 'Blue';
$txt['beige'] = 'Beige';
$txt['brown'] = 'Brown';
$txt['teal'] = 'Teal';
$txt['navy'] = 'Navy';
$txt['maroon'] = 'Maroon';
$txt['lime_green'] = 'Lime Green';
$txt['white'] = 'White';


I'm on 2.0.15. . Where is the post.english.php file?

Arantor


Jeremy M.

Quote from: Arantor on February 01, 2019, 02:39:18 AM
Themes/default/languages

Thanks Arantor. . Found it before you replied. . LOL. . Some colors will work, some won't. . LOL

Advertisement: