tools/android/checkxmlstyle/checkxmlstyle.py
def _CheckColorFormat(input_api, output_api):
  """Checks color (A)RGB values are of format either RRGGBB or AARRGGBB."""
  errors = []
  for f in IncludedFiles(input_api):
    # Ignore vector drawable xmls
    contents = input_api.ReadFile(f)
    if '<vector' in contents:
      continue
    for line_number, line in f.ChangedContents():
      color = helpers.COLOR_PATTERN.search(line)
      if color and not helpers.VALID_COLOR_PATTERN.match(color.group(2)):
        errors.append(
            '  %s:%d\n    \t%s' % (f.LocalPath(), line_number, line.strip()))
  if errors:
    return [
        output_api.PresubmitError(
            '''
  Android Color Reference Check failed:
    Your new code added (A)RGB values for colors that are not well
    formatted, listed below.

    This is banned, please define colors in format of #RRGGBB for opaque
    colors or #AARRGGBB for translucent colors. Note that they should be
    defined in chrome/android/java/res/values/color_palette.xml.

    If the new added color is a one-off color, please contact UX for approval
    and then add it to ui/android/java/res/values/one_off_colors.xml

    See https://crbug.com/775198 for more information.
  ''', errors)
    ]
  return []
Checks color (A)RGB values are of format either RRGGBB or AARRGGBB.
Checks color (A)RGB values are of format either RRGGBB or AARRGGBB.
Checks color ( A ) RGB values are of format either RRGGBB or AARRGGBB .
def _CheckColorFormat(input_api, output_api):
  errors = []
  for f in IncludedFiles(input_api):
    contents = input_api.ReadFile(f)
    if '<vector' in contents:
      continue
    for line_number, line in f.ChangedContents():
      color = helpers.COLOR_PATTERN.search(line)
      if color and not helpers.VALID_COLOR_PATTERN.match(color.group(2)):
        errors.append(
            '  %s:%d\n    \t%s' % (f.LocalPath(), line_number, line.strip()))
  if errors:
    return [
        output_api.PresubmitError(
            '''
  Android Color Reference Check failed:
    Your new code added (A)RGB values for colors that are not well
    formatted, listed below.
    This is banned, please define colors in format of #RRGGBB for opaque
    colors or #AARRGGBB for translucent colors. Note that they should be
    defined in chrome/android/java/res/values/color_palette.xml.
    If the new added color is a one-off color, please contact UX for approval
    and then add it to ui/android/java/res/values/one_off_colors.xml
    See https://crbug.com/775198 for more information.
  ''', errors)
    ]
  return []
def _CheckColorFormat ( input_api , output_api ) : errors = [ ] for f in IncludedFiles ( input_api ) : contents = input_api . ReadFile ( f ) if '<vector' in contents : continue for line_number , line in f . ChangedContents ( ) : color = helpers . COLOR_PATTERN . search ( line ) if color and not helpers . VALID_COLOR_PATTERN . match ( color . group ( 2 ) ) : errors . append ( '  %s:%d\n    \t%s' % ( f . LocalPath ( ) , line_number , line . strip ( ) ) ) if errors : return [ output_api . PresubmitError ( '''
  Android Color Reference Check failed:
    Your new code added (A)RGB values for colors that are not well
    formatted, listed below.

    This is banned, please define colors in format of #RRGGBB for opaque
    colors or #AARRGGBB for translucent colors. Note that they should be
    defined in chrome/android/java/res/values/color_palette.xml.

    If the new added color is a one-off color, please contact UX for approval
    and then add it to ui/android/java/res/values/one_off_colors.xml

    See https://crbug.com/775198 for more information.
  ''' , errors ) ] return [ ]
Checks color (A)RGB values are of format either RRGGBB or AARRGGBB.
Checks color ( A ) RGB values are of format either RRGGBB or AARRGGBB .
"""Checks color (A)RGB values are of format either RRGGBB or AARRGGBB.""" # Ignore vector drawable xmls
input_api
output_api