NVIDIA / NVIDIA/cutlass

[QST] Unify The Color for Latex and SVG Print

Open
#1,860 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

? - Needs Triage inactive-30d question
Dominant language
C++
Stars
10.5k
Forks
2.1k
Avg merge
3d 11h
Merged PRs (30d)
7

Description

What is your question?

With the release of Cutlass 3.6, the print_latex function now allows users to specify colors using a template parameter. However, the print_svg function's color is still hardcoded. To enhance its usability, we should extend the color parameterization feature to print_svg.

We'll first examine how print_latex handles color. It uses the TikzColorFn class as the template parameter for print_latex, which provides a color string for LaTeX TikZ format (e.g., {rgb,255:red,175;green,175;blue,255}) through the TikzColor_TV structure's operator() function.

I propose two approaches:

  1. Define SvgColorFn and SvgColor_TV similar to TikzColorFn and TikzColor_TV, returning SVG-compatible color strings (e.g., rgb(255,175,175)).
    Pros: Easy to code; can be implemented by copying and modifying existing code.
    Cons: Color definitions would be duplicated for LaTeX and SVG.
  2. Create a unified ColorFn and ColorTV that return RGB values (int values, not color strings specific to TikZ or SVG). The print_latex/svg functions would then construct the color strings for LaTeX and SVG.
    Pros: A unified color representation (RGB tuple with int type), making it easier for future users.
    Cons: More complex coding required:
    • Change TikzColor_TV to Color_TV.
    • Convert TikzColor_TV's color strings to pure RGB tuples.
    • Modify the operator() function to return RGB values(eg. void operator(int tid, int vid, int &r, int &g, int &b)).
    • Have print_latex and print_svg construct their own color strings.
    • Rename the template parameter from TikzColorFn to ColorFn.
    • Unify TikzColorWhite and TikzColorBWx8 to RGB tuple representations.

I advocate for the second approach. What are your thoughts?

Reference:
https://github.com/NVIDIA/cutlass/pull/1733

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the existing print_latex and print_svg implementations and the TikzColorFn and TikzColor_TV types, then review the referenced pull request. Resolve whether to add SVG-specific color types or unify RGB handling before changing the API. Done means both output functions support configurable colors with a settled, tested design.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.