def _showColor()

in commands/FBVisualizationCommands.py [0:0]


def _showColor(color):
    color = "(" + color + ")"

    colorToUse = color
    isCF = _colorIsCGColorRef(color)
    if isCF:
        colorToUse = "[[UIColor alloc] initWithCGColor:(CGColorRef){}]".format(color)
    else:
        isCI = objectHelpers.isKindOfClass(color, "CIColor")
        if isCI:
            colorToUse = "[UIColor colorWithCIColor:(CIColor *){}]".format(color)

    imageSize = 58
    fb.evaluateEffect(
        "UIGraphicsBeginImageContextWithOptions((CGSize)CGSizeMake({imageSize}, {imageSize}), NO, 0.0)".format(
            imageSize=imageSize
        )
    )
    fb.evaluateEffect("[(id){} setFill]".format(colorToUse))
    fb.evaluateEffect(
        "UIRectFill((CGRect)CGRectMake(0.0, 0.0, {imageSize}, {imageSize}))".format(
            imageSize=imageSize
        )
    )

    result = fb.evaluateExpressionValue(
        "(UIImage *)UIGraphicsGetImageFromCurrentImageContext()"
    )
    if result.GetError() is not None and str(result.GetError()) != "success":
        print("got error {}".format(result))
        print(result.GetError())
    else:
        image = result.GetValue()
        _showImage(image)

    fb.evaluateEffect("UIGraphicsEndImageContext()")