INNER CODE UNIT · Python

to_camel_case

wikimedia/apps-android-wikipedia · scripts/generate-codex-colors.py:72

def to_camel_case(text):
    # Split on both single and double dashes
    parts = re.split(r'-+', text)
    if not parts:
        return text
    # First part will be lowercase, rest are capitalized
    return parts[0].lower() + ''.join(word.capitalize() for word in parts[1:] if word)


# colors_dict: the processed codex colors with { name: value } format
# file_path: path where you want to save the file
def generate_compose_raw_color_file(colors_dict, file_path):
    if not colors_dict:
        print("Warning: No raw colors to generate class")
        return False

    content = ["package org.wikipedia.compose\n\n",
               "import androidx.compose.ui.graphics.Color\n\n",

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…