Invert Colors

Challenge Difficulty: Easy | Estimated completion time: ~5 minutes

Create a function that inverts the rgb values of a given list.

Examples

color_invert([255, 255, 255])
output = [0, 0, 0]
# [255, 255, 255] is the color white.
# The opposite is [0, 0, 0], which is black.
 
color_invert([0, 0, 0])
output = [255, 255, 255]
 
color_invert([165, 170, 221])
output = [90, 85, 34]

Notes

  • Must return a list.
  • 255 is the max value of a single color channel.

Solution

Python
Output