Set background to Gray

Report a typo

The function setBackgroundToGray() is called with a string parameter and returns the same string wrapped in two ANSI sequences. The first one – a 256-color ANSI sequence – sets the background color to Gray, and the second one resets the colors to their default values. Example: "<set background to Gray sequence><original string><reset sequence>". The gray shade should have the color number 236.

Your task is to write the code for the setBackgroundToGray() function.

Write a program in Kotlin
fun setBackgroundToGray(str: String): String {
// Write your code here

//
}
___

Create a free account to access the full topic