Skip to content

ink: <Text dimColor> renders as [object Object] #5039

Description

@proggeramlug

Follow-up discovered while landing ink #348 end-to-end (PR #5038).

Repro

import React from 'react';
import { render, Box, Text } from 'ink';
function App() {
  return (
    <Box flexDirection="column">
      <Text dimColor>A dimColor plain ascii</Text>
      <Text>B plain text</Text>
      <Text color="cyan">C colored ascii</Text>
    </Box>
  );
}
const { unmount } = render(<App />);
setTimeout(() => unmount(), 100);

Actual

[object Object]
B plain text
C colored ascii

The dimColor line renders as [object Object] instead of its text. color="cyan" (a chalk color) renders fine, so the issue is specific to ink's handling of the boolean style modifiers (dimColor, and likely bold/italic/underline/inverse/strikethrough).

Notes

  • ink's <Text> maps dimColor to a chalk modifier (chalk.dim) vs color to chalk[color]. The boolean-modifier path produces an object where the string-color path produces a string — points at how the chalk modifier function/proxy is being applied or coerced when compiled natively.
  • Layout/borders are unaffected — purely a text-styling coercion issue.
  • Separate from the yoga/taffy + JSON-import + Context.Provider work in feat: native yoga-layout via taffy + JSON module imports — ink #348 end-to-end #5038; everything else in ink renders correctly.

Part of #348.

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