Skip to content

Marker RGB colors #1873

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jminor opened this issue Apr 16, 2025 · 6 comments
Open

Marker RGB colors #1873

jminor opened this issue Apr 16, 2025 · 6 comments

Comments

@jminor
Copy link
Collaborator

jminor commented Apr 16, 2025

OTIO Markers have a "color" attribute which is a string taken from a list of color names ("RED", "GREEN", "YELLOW", etc.) However, some systems specify named colors that are not in this list, or allow arbitrary RGB values. In order to support a wider set of marker colors, we could switch OTIO to use an RGB triple like (255, 127, 0) or (1.0, 0.5, 0.0) and include helper functions to convert to and from lists of color names.

See prior work & discussion here: #27

To limit the scope of this a bit, let us assert that markers never have a transparency/alpha, and that marker colors are not managed through colorspaces (sRGB, etc.). If anyone can show a counter example in an existing application, format, or workflow, please post it here.

@jminor
Copy link
Collaborator Author

jminor commented Apr 16, 2025

For reference, here is an example marker with both a named color and an RGB value from an AAF:

"CommentMarkerAttributeList": {
    "_ATN_CRM_COLOR": "Red",
    "_ATN_CRM_DATE": "04/01/2022",
    "_ATN_CRM_ID": "060a2b340101010501010f1013-000000-1236214796719905-cec1f01898f1-77b8",
    "_ATN_CRM_LONG_CREATE_DATE": 1648865092,
    "_ATN_CRM_LONG_MOD_DATE": 1648865100,
    "_ATN_CRM_TIME": "19:04",
    "_ATN_CRM_USER": "m1"
},
"CommentMarkerColor": {
    "blue": 6564,
    "green": 12134,
    "red": 41471
},

Also, here is a mapping between named colors in new/old versions of Avid Media Composer (from the Media Composer 2024.6 release notes) which illustrates the range of colors available in some real world applications.
Image

@jminor
Copy link
Collaborator Author

jminor commented Apr 16, 2025

See also this code which attempts to map between RGB and named colors when reading an AAF: https://github.com/OpenTimelineIO/otio-aaf-adapter/blob/main/src/otio_aaf_adapter/adapters/advanced_authoring_format.py#L208

def _convert_rgb_to_marker_color(rgb_dict):
    """Returns a matching OTIO marker color for a given AAF color string.

    Adapted from `get_nearest_otio_color()` in the `xges.py` adapter.

    Args:
        rgb_dict (dict): marker color as dict,
                         e.g. `"{'red': 41471, 'green': 12134, 'blue': 6564}"`

    Returns:
        otio.schema.MarkerColor: converted / estimated marker color

    """

@jminor
Copy link
Collaborator Author

jminor commented Apr 16, 2025

See also this other use of colors for tracks and clips: #1614

@jminor
Copy link
Collaborator Author

jminor commented Apr 16, 2025

And also this document which details how FCP 7 XML and Premiere Pro store colors: https://github.com/AcademySoftwareFoundation/OpenTimelineIO/wiki/Editorial-File-Format-Notes

@meshula
Copy link
Collaborator

meshula commented Apr 16, 2025

In another forum I mentioned sticking to color interop forum colorspaces, but I support restricting user interface element colors to sRGB.

@reinecke
Copy link
Collaborator

Curious what happens in applications that store RGB in files when you use colors that aren't in their set of selectable colors - we should try this out to see what happens.

Here's how I've been mapping colors from Premiere and FCP 7 based on the names in the UIs:

""" This is a mapping of ppro colors to named colors. """
PPRO_COLOR_MAP = {
    # ppro color values are the int of their 8-bit per channle ABGR values.
    0xFF863771: "GREEN",
    0xFF2C36D2: "RED",
    0xFF8BB1AF: "PINK",
    0xFF246FE9: "ORANGE",
    0xFF2BA1D0: "YELLOW",
    0xFFFFFFFF: "WHITE",
    0xFFFC8D42: "BLUE",
    0xFFB18BAF: "PURPLE",
    0xFFD6F419: "TURQUOISE",
}

FCP7_COLOR_MAP = {
    (255, 0, 0): "RED",
    (255, 127, 0): "ORANGE",
    (255, 255, 0): "YELLOW",
    (48, 191, 72): "GREEN",
    (48, 191, 191): "TURQUOISE",
    (0, 128, 255): "BLUE",
    (127, 0, 255): "PURPLE",
    (255, 0, 127): "PINK",
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants