I was thinking about this in the context of creating task requirements, having having to explicitly define how a program is to function.
One might say:
Law is often described as black and white, for most cases it is quite clear whether something falls within the bounds of the law or not. However, unlike law, computer programming is quite literally black and white, there are no areas that are open for interpretation.
What I'm meaning, isn't that computer programming is literally the colours black and white. But that it is binary and deterministic, there's not room for interpretation. Whereas for other fields, even though law can be described as 'black and white' there are areas that are open for interpretation.
I think you could argue that the use of literally here is correct - that is, computer programming literally matches what the idiom 'black and white' is expressing.
If literally isn't correct, what phrase can one use here instead?