Я знаю, как изменить цвет первой строки.
console.log ( '%c%s', 'color:' + color, str )
Но моя строка выглядит следующим образом.
console.log('%c'+ args[args.length-1], 'color:' + color,performance['now'](true, args[args.length-1]),'[(', ...args.slice(0, args.length-1),'*)',`${message}`,']')
Это даст мой результат: ![It is give my this result:](https://i.stack.imgur.com/TICBx.png)
Как я могу изменить свой console.log, чтобы сообщение '~~~~~~~~~ пример ~~~~~~~~~~' также меняло цвет?
Добавление:
Я не понимаю ...
Все примеры имеют вид
console.log ( '%c%s', 'color:' + color, str )
Я сделал одну строку такого рода и мой цвет сохранился. Но вот еще одна проблема.
console.log(`%c ${args[args.length-1]} ${performance['now'](true, args[args.length-1])} [(${args.slice(0, args.length-1)} *) ${message}]`, 'color:' + color)
результат:
![result](https://i.stack.imgur.com/uWOsM.png)
Но как мне отображать объекты в развернутом виде?
При попытке добавить второй цвет в консоль она этого не видит.
console.log('%c'+ args[args.length-1], 'color:' + color,performance['now'](true, args[args.length-1]),'[(', ...args.slice(0, args.length-1),'*)',`%c` +`${message}`,']','color:' + color)
результат:
![result](https://i.stack.imgur.com/A4djN.png)
Добавление:
результат ваш:
![result one](https://i.stack.imgur.com/zl0wG.png)
console.log('%c%O' + ' '+ args[args.length-1],'color:' + color,performance['now'](end, args[args.length-1], message),'[(', ...args.slice(0, args.length-1),'*)',message,']')
результат, который я использую:
![color not work](https://i.stack.imgur.com/t3kTi.png)
![enter image description here](https://i.stack.imgur.com/oOMzp.png)
![enter image description here](https://i.stack.imgur.com/z5s8O.png)