| | Mewyn 

Voir le dossier scolaire Ex-candidate SoP Story Rang spécial: Directrice & Formatrice graph' 
Nombre de messages: 2999 Age: 16 Localisation: Gironde (33) $ops: 5753 Points: 685 Date d'inscription: 05/06/2011 Distinctions:
| | |
 | Sujet: [Templates] Ajout de couleurs Dim 21 Aoû - 15:55 | |
| Templates { Ajout de couleurs } Langage ; Templates Niveau du tutoriel ; ★★★☆☆ Quelque chose à ajouter avant de commencer ? A la fin de ce tutoriel, vous arriverez à faire ceci :  Commençons par aller dans les templates : # Affichage # Templates # Poster & Messages privés # posting_body # | Spoiler: | | |  |
Dans ce template, seulement cette partie nous intéresse :
| Code: | <div style="visibility:hidden" class="select" id="color"> <button style="color:darkred" onclick="bbfontstyle('[color=darkred]','[/color]');selectWysiwyg(this,'color');return false">{L_COLOR_DARK_RED}</button>
<button style="color:red" onclick="bbfontstyle('[color=red]','[/color]');selectWysiwyg(this,'color');return false">{L_COLOR_RED}</button>
<button style="color:orange" onclick="bbfontstyle('[color=orange]','[/color]');selectWysiwyg(this,'color');return false">{L_COLOR_ORANGE}</button>
<button style="color:brown" onclick="bbfontstyle('[color=brown]','[/color]');selectWysiwyg(this,'color');return false">{L_COLOR_BROWN}</button>
<button style="color:yellow" onclick="bbfontstyle('[color=yellow]','[/color]');selectWysiwyg(this,'color');return false">{L_COLOR_YELLOW}</button>
<button style="color:green" onclick="bbfontstyle('[color=green]','[/color]');selectWysiwyg(this,'color');return false">{L_COLOR_GREEN}</button>
<button style="color:olive" onclick="bbfontstyle('[color=olive]','[/color]');selectWysiwyg(this,'color');return false">{L_COLOR_OLIVE}</button>
<button style="color:cyan" onclick="bbfontstyle('[color=cyan]','[/color]');selectWysiwyg(this,'color');return false">{L_COLOR_CYAN}</button>
<button style="color:blue" onclick="bbfontstyle('[color=blue]','[/color]');selectWysiwyg(this,'color');return false">{L_COLOR_BLUE}</button>
<button style="color:darkblue" onclick="bbfontstyle('[color=darkblue]','[/color]');selectWysiwyg(this,'color');return false">{L_COLOR_DARK_BLUE}</button>
<button style="color:indigo" onclick="bbfontstyle('[color=indigo]','[/color]');selectWysiwyg(this,'color');return false">{L_COLOR_INDIGO}</button>
<button style="color:violet" onclick="bbfontstyle('[color=violet]','[/color]');selectWysiwyg(this,'color');return false">{L_COLOR_VIOLET}</button>
<button style="color:lightgrey" onclick="bbfontstyle('[color=white]','[/color]');selectWysiwyg(this,'color');return false">{L_COLOR_WHITE}</button>
<button style="color:black" onclick="bbfontstyle('[color=black]','[/color]');selectWysiwyg(this,'color');return false">{L_COLOR_BLACK}</button>
</div> |
Chaque ligne correspond à une couleur. Décortiquons la dernière ligne, soit la couleur noir.
| Code: | <button style="color:black" onclick="bbfontstyle('[color=black]','[/color]');selectWysiwyg(this,'color');return false">{L_COLOR_BLACK}</button>
|
On pourrait la découper en 3 parties, soit, celles que l'on peut modifier :
| Code: | <button style="color:black" |
Après color se trouve le nom de la couleur, ou le code. On pourrait très bien mettre
| Code: | <button style="color:[b]#000000[/b]" |
Le résultat serait le même. Il y a ensuite
| Code: | onclick="bbfontstyle('[color=black]','[/color]'); |
C'est la commande à faire pour appeler la couleur définie plus haut. On finit par
| Code: | ;selectWysiwyg(this,'color');return false">{L_COLOR_BLACK}</button> |
Le {L_COLOR_BLACK} définit le nom de la couleur dans le sélecteur. Je vais par exemple ajouter la couleur crimson, que j’appellerais donc Crimson. Je vais donc copier une ligne et modifier ce que je souhaite :
| Code: | <button style="color:crimson" onclick="bbfontstyle('[color=crimson]','[/color]');selectWysiwyg(this,'color');return false">Crimson</button>
|
Vous pouvez donc aussi supprimer une couleur en supprimant sa ligne. Note : Ceci ne marche pas pour le titre, juste pour l'éditeur de message.
Des questions ? C'est [ici]
_________________ 
 |
|