@@ -246,10 +246,7 @@ func (c *Color) Printf(format string, a ...interface{}) (n int, err error) {
246
246
// On Windows, users should wrap w with colorable.NewColorable() if w is of
247
247
// type *os.File.
248
248
func (c * Color ) Fprintln (w io.Writer , a ... interface {}) (n int , err error ) {
249
- c .SetWriter (w )
250
- defer c .UnsetWriter (w )
251
-
252
- return fmt .Fprintln (w , a ... )
249
+ return fmt .Fprintln (w , c .wrap (fmt .Sprint (a ... )))
253
250
}
254
251
255
252
// Println formats using the default formats for its operands and writes to
@@ -258,10 +255,7 @@ func (c *Color) Fprintln(w io.Writer, a ...interface{}) (n int, err error) {
258
255
// encountered. This is the standard fmt.Print() method wrapped with the given
259
256
// color.
260
257
func (c * Color ) Println (a ... interface {}) (n int , err error ) {
261
- c .Set ()
262
- defer c .unset ()
263
-
264
- return fmt .Fprintln (Output , a ... )
258
+ return fmt .Fprintln (Output , c .wrap (fmt .Sprint (a ... )))
265
259
}
266
260
267
261
// Sprint is just like Print, but returns a string instead of printing it.
@@ -271,7 +265,7 @@ func (c *Color) Sprint(a ...interface{}) string {
271
265
272
266
// Sprintln is just like Println, but returns a string instead of printing it.
273
267
func (c * Color ) Sprintln (a ... interface {}) string {
274
- return c . wrap ( fmt .Sprintln (a ... ))
268
+ return fmt .Sprintln ( c . Sprint (a ... ))
275
269
}
276
270
277
271
// Sprintf is just like Printf, but returns a string instead of printing it.
@@ -353,7 +347,7 @@ func (c *Color) SprintfFunc() func(format string, a ...interface{}) string {
353
347
// string. Windows users should use this in conjunction with color.Output.
354
348
func (c * Color ) SprintlnFunc () func (a ... interface {}) string {
355
349
return func (a ... interface {}) string {
356
- return c . wrap ( fmt .Sprintln (a ... ))
350
+ return fmt .Sprintln ( c . Sprint (a ... ))
357
351
}
358
352
}
359
353
0 commit comments