Moodle Plugins directory: Tiny Font Color | Moodle.org

Tiny Font Color
TinyMCE ::: tiny_fontcolor
Maintained by
Stephan Robotta,
Luca Bösch
The Tiny Font Color provides two toolbar buttons and menu entries to set different text and background colors.
Latest release:
3330 sites
1k downloads
39 fans
Current versions available: 1
Overview
The plugin provides two buttons in the TinyMCE editor to set a text- and a background color. Colors can be defined by the site admin, so that the user may be limited to the predefined colors. In addtion the color picker can be enabled or disabled. Settings are separate for text color and background color.
How to install
- Unzip the plugin in the Moodle .../lib/editor/tiny/plugins/fontcolor/ directory.
- As a Moodle Admin go to Site Administration -> Plugins -> Text Editors -> TinyMCE editor -> Tiny text color/text background color settings and add a view color names and color codes for at least on of the setting "Available text colors" or "Available text background colors".
- Optional enable/disable the color picker for text color or background color.
If no colors are available and the color picker is disabled then the menu item and button in the TinyMCE editor will not appear. This is valid for both, the text color setting and the background color setting.
The color name can be an arbitrary string e.g. Red or Dark Green or whatever you name your color. The name can be also the "corporate name" e.g. that is used in any style guides of the corporate identity at your institution.
Useful links
Contributors
Stephan Robotta (Lead maintainer)
Luca Bösch
Please login to view contributors details and/or to contact them
It would be great if it was available for php 7.4, 8.0 and 8.1, versions compatible with moodle 4.1 (LTS). It's not easy for us update php in our PROD servers.
Regards, Miguel
Version 0.2.1 has been released that should work now with PHP7.x as well.
Best regards, Stephan
After installing the plugin, we had the following error in Moodle 4.2:
Error: Database connection failed
It is possible that the database is overloaded or otherwise not running properly.
The site administrator should also check that the database details have been correctly specified in config.php
The database error should not be related with the installation of this plugin. It's a general error that the database cannot be reached. Can you ensure that the database is running (e.g. check the direct connection via the console or other tool), ans also think about what else did you modify in your installation when you were installing the plugin.
Best regards, Stephan
Thank you for your positive feedback, that you find the plugin useful.
Answering your question:
All settings are stored at the database. The following query fetches you all settings:
select * from m_config_plugins where plugin = 'tiny_fontcolor';
The settings textcolors and backgroundcolors define the color palette. This is a simple json string:
[{"name": "color name", "value": "#hexcode"}]
You can have as many name/value tuples. The name string may contain html e.g. to have the color name defined in different languages:
[{"name":"Weiss<\/span>White<\/span>","value":"#ffffff"}
HTH, Stephan
Thanks for responding!
Adding the following list to the tiny_fontcolor textcolors table and the tiny_fontcolor backgroundcolors table makes the full textcolor_map available to your tiny_fontcolor plugin!
[{"name":"Black","value":"#000000"},{"name":"Burnt orange","value":"#993300"},{"name":"Dark olive","value":"#333300"},{"name":"Dark green","value":"#003300"},{"name":"Dark azure","value":"#003366"},{"name":"Navy Blue","value":"#000080"},{"name":"Indigo","value":"#333399"},{"name":"Very dark gray","value":"#333333"},{"name":"Maroon","value":"#800000"},{"name":"Orange","value":"#FF6600"},{"name":"Olive","value":"#808000"},{"name":"Green","value":"#008000"},{"name":"Teal","value":"#008080"},{"name":"Blue","value":"#0000FF"},{"name":"Grayish blue","value":"#666699"},{"name":"Gray","value":"#808080"},{"name":"Red","value":"#FF0000"},{"name":"Amber","value":"#FF9900"},{"name":"Yellow green","value":"#99CC00"},{"name":"Sea green","value":"#339966"},{"name":"Turquoise","value":"#33CCCC"},{"name":"Royal blue","value":"#3366FF"},{"name":"Purple","value":"#800080"},{"name":"Medium gray","value":"#999999"},{"name":"Magenta","value":"#FF00FF"},{"name":"Gold","value":"#FFCC00"},{"name":"Yellow","value":"#FFFF00"},{"name":"Lime","value":"#00FF00"},{"name":"Aqua","value":"#00FFFF"},{"name":"Sky blue","value":"#00CCFF"},{"name":"Red violet","value":"#993366"},{"name":"White","value":"#FFFFFF"},{"name":"Pink","value":"#FF99CC"},{"name":"Peach","value":"#FFCC99"},{"name":"Light yellow","value":"#FFFF99"},{"name":"Pale green","value":"#CCFFCC"},{"name":"Pale cyan","value":"#CCFFFF"},{"name":"Light sky blue","value":"#99CCFF"},{"name":"Plum","value":"#CC99FF"}]
Just what I needed, Thanks again!
"Add json for a comprehensive color scheme (thanks to Joseph Rézeau)."
How can we use this function?
TIA
in one of the previous comments Joseph provided a color scheme. This color scheme is provided within the zip file (in the root folder) of the plugin. The README file contains an explanation on how to manually update it into your database. There is no button etc. that would fill this scheme via a click.
Best regards, Stephan
Thank you for your quick answer. I tried this SQL command, and it works
UPDATE mdl_config_plugins
SET value = '[{"name":"Black","value":"#000000"},{"name":"Burnt orange","value":"#993300"},{"name":"Dark olive","value":"#333300"},{"name":"Dark green","value":"#003300"},{"name":"Dark azure","value":"#003366"},{"name":"Navy Blue","value":"#000080"},{"name":"Indigo","value":"#333399"},{"name":"Very dark gray","value":"#333333"},{"name":"Maroon","value":"#800000"},{"name":"Orange","value":"#FF6600"},{"name":"Olive","value":"#808000"},{"name":"Green","value":"#008000"},{"name":"Teal","value":"#008080"},{"name":"Blue","value":"#0000FF"},{"name":"Grayish blue","value":"#666699"},{"name":"Gray","value":"#808080"},{"name":"Red","value":"#FF0000"},{"name":"Amber","value":"#FF9900"},{"name":"Yellow green","value":"#99CC00"},{"name":"Sea green","value":"#339966"},{"name":"Turquoise","value":"#33CCCC"},{"name":"Royal blue","value":"#3366FF"},{"name":"Purple","value":"#800080"},{"name":"Medium gray","value":"#999999"},{"name":"Magenta","value":"#FF00FF"},{"name":"Gold","value":"#FFCC00"},{"name":"Yellow","value":"#FFFF00"},{"name":"Lime","value":"#00FF00"},{"name":"Aqua","value":"#00FFFF"},{"name":"Sky blue","value":"#00CCFF"},{"name":"Red violet","value":"#993366"},{"name":"White","value":"#FFFFFF"},{"name":"Pink","value":"#FF99CC"},{"name":"Peach","value":"#FFCC99"},{"name":"Light yellow","value":"#FFFF99"},{"name":"Pale green","value":"#CCFFCC"},{"name":"Pale cyan","value":"#CCFFFF"},{"name":"Light sky blue","value":"#99CCFF"},{"name":"Plum","value":"#CC99FF"}]'
WHERE plugin = 'tiny_fontcolor' AND name = 'textcolors';
Csaba
We've had recent security scans on our Moodle sites and the polyfill.js raised some concerns as there's a vulnerability linked to that JavaScript library: https://sansec.io/research/polyfill-supply-chain-attack
Matt Porritt from Moodle HQ wrote that the Moodle core file of the same name is not the same as the one linked to the aforementioned vulnerability: https://moodle.org/mod/forum/discuss.php?d=459883
We're wondering, since we've found a similar JS file in your plugin, if this Javascript library is used by your plugin? Here's the path: /lib/editor/tiny/plugins/fontcolor/amd/src/polyfill.js
Thanks!
The pollyfill.js in the plugin has no relations with the pollyfill library. The code in that file was mostly used from the original color plugin of the TinyMCE (that natively offers quite the same two buttons but with a different setup). Some small parts of the code was written by me. All these are helper functions that provide basic functionality that is used in the plugin.
I cannot verify where the original code was taken from and howmit got into the TinyMCE. However, aftwr reading our link, the plugin has no relation to the current pollyfill library. It's entirely served whithin the project without using any CDN.
Best regards, Stephan
you wrote:
Hi Stephan,
Thanks for responding!
Adding the above list to the tiny_fontcolor textcolors table and the tiny_fontcolor backgroundcolors table makes the full textcolor_map available to your tiny_fontcolor plugin!
i am not a programmer - can you let me know where and how I have to add this particular list?
It would be so helpful to have a set of colours.
Thank you, Tanja
To get the colors into your Moodle, use the SQL command that Csaba wrote a few comments above. This sets the text colors. The background colors are set in the same way. The README.md contains information about the variable names.
You need to have access to your Moodle database to do this.