Skip to content

Border Color #352

Open
Open

Description

@0xJWLabs

Is there a way to change border color using hex? Thanks!

Activity

  1. speedytwenty commented on Aug 25, 2024

    @speedytwenty
    Collaborator

    Try something like:

    const Table = require('cli-table3');
    
    const table = new Table({ style: { border: ['blue'] } });
    table.push(['foo']);
    
    console.log(table.toString());

    Produces:
    image

    This isn't well documented because of how the documentation is generated (without color). The documentation shows removing the default grey border, but doesn't show setting a color.

  2. speedytwenty commented on Aug 25, 2024

    @speedytwenty
    Collaborator

    "using hex"

    I apologize, I overlooked this part of your question. I see now that setting a hex color does not work.

    I don't see an obvious way. It would require customizing the "border chars" somewhat like: https://github.com/cli-table/cli-table3/blob/master/basic-usage.md#stylize-the-table-with-custom-border-characters

  3. 0xJWLabs commented on Aug 26, 2024

    @0xJWLabs
    Author

    @speedytwenty I think using chalk or ansis isn’t really a good way right? since i saw there’s somehow a leftover of the ansi like let’s say

    ————;30;60m

  4. webdiscus commented on Feb 9, 2025

    @webdiscus
    Contributor

    Hello @0xJWLabs,

    I'm the author of ansis.

    In the #354 PR I have added the support for hex code to allow using a truecolor in a table.

    The proposal for new syntax:

    style: { 
      border: ['hex(#FFD700)'], 
      head: ['hex(#FFA500)', 'bgHex(#3d239d)']
    }
  5. added a commit that references this issue on Apr 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions