Skip to content

Inspection for misuse of QBColor function #3564

Open
@ThunderFrame

Description

@ThunderFrame

The QBColor function returns color values used by earlier versions of Basic (such as Microsoft Visual Basic for MS-DOS and the Basic Compiler), and as such should be considered deprecated.

Furthermore, while the function accepts an integer, a run-time error occurs if the parameter value isn't between 0 and 15, and the values that are between 0 and 15 are not meaningful.

50% of the returned values are already defined as constants in VBA.ColorConstants

RD should inspect for usages of QBColor and suggest replacing with a color constant or an RGB function. RD should also inspect for usages of QBColor where the index might not be in the 0-15 range.

Index    RGB (Hex)   VBA.ColorConstants
 0       &H000000    'vbBlack
 1       &H800000
 2       &H008000
 3       &H808000
 4       &H000080
 5       &H800080
 6       &H008080
 7       &HC0C0C0
 8       &H808080
 9       &HFF0000    'vbBlue
 10      &H00FF00    'vbGreen
 11      &HFFFF00    'vbCyan
 12      &H0000FF    'vbRed
 13      &HFF00FF    'vbMagenta
 14      &H00FFFF    'vbYellow
 15      &HFFFFFF    'vbWhite

Metadata

Metadata

Assignees

No one assigned

    Labels

    edge-caseMarks a bug as an edge case that would be nice to fix, but that likely doesn't affect normal use.enhancementFeature requests, or enhancements to existing features. Ideas. Anything within the project's scope.feature-inspections

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions