The numbers must first be entered into the cells or returned by the formulae contained in the cells in any case. To colour the cells regarding your chosen assignment is then the duty of the Conditional Format (CF) you have to define.
By regular CF you will need to define 9 dedicated cell styles and 9 conditions for overlaying them. The ColourScale option is not appropriate for the purpose.
To make the numeric (or even string) values of the cells referable, and controlling the CF, but invisible, you need to set the appropriate format code under Format Cells... > Numbers
in the appropriate way. To not display any content set the format code to "";"";"";""
where the 4 parts will apply to positive values, negative values, zero value, and string in this order. You may use this code (or a similar one better meeting your needs) to the cells generally or to any of the cell styles to overlay condtionally.
I don’t clearly understand what you mean by “…and the corresponding colour is used to populate the cell?”
You should never try to use a colour as the primary representation of any information. To do so is very bad design and is not supported by standard functions.
A conditionally overlaid colour (or the used cell style) you cannot evaluate (refer to) anyway because it is only generated/applied for the view and never actually assigned to the cell object.
(This applies to all versions of LibreOffice I know.)