unjs / consola

🐨 Elegant Console Logger for Node.js and Browser
Other
6.12k stars 175 forks source link

Using consola.box with colors in the body adds extra padding #316

Open TheDutchCoder opened 1 month ago

TheDutchCoder commented 1 month ago

Environment

Node: v20.13.0 OS: MacOS Sequoia 15 consola: 3.2.3

Reproduction

consola.box({
  title: ' RVezy Nuxt tools' ,
  message: ` Tools and commands for a better Developer Experience `,
  style: {
    padding: 1,
    borderColor: "cyan",
  },
});

// Outputs
// ╭─────────────────── RVezy Nuxt tools ─────────────────────╮
// │                                                          │
// │   Tools and commands for a better Developer Experience   │
// │                                                          │
// ╰──────────────────────────────────────────────────────────╯

However

consola.box({
  title: ` ${colors.blue('RVezy')} ${colors.cyan('Nuxt')} ${colors.blue('tools')} `,
  message: ` ${colors.blue('Tools')} and ${colors.blue('commands')} for a better Developer Experience`,
  style: {
    padding: 1,
    borderColor: "cyan",
  },
});

// Outputs
// ╭──────────────────────────── RVezy Nuxt tools ───────────────────────────────╮
// │                                                                             │
// │   Tools and commands for a better Developer Experience                      │
// │                                                                             │
// ╰─────────────────────────────────────────────────────────────────────────────╯

Describe the bug

When using colors in the body part of a box, it adds a lot of padding at the end.

Additional context

No response

Logs

No response