diff --git a/.github/md-generator/generate_markdown.py b/.github/md-generator/generate_markdown.py new file mode 100644 index 00000000000..6ee133b0ede --- /dev/null +++ b/.github/md-generator/generate_markdown.py @@ -0,0 +1,287 @@ +import os + +PIPE = "|" +SLASH = "/" +SVG_EXTENSION = ".svg" +PDF_EXTENSION = ".pdf" +BREAK = "\n" + +# Show or hide and reorder brands as needed +brands = ["telefonica", "o2", "vivo-new", "blau"] + +# Define the colors for the bar representation +bar_colors = { + "unique": "59C2C9", + "all_equivalence": "0066FF", + "some_equivalence": "EAC344", + "missing": "D1D5E4" +} + +# List folders in icons directory +def read_folder(folder): + if os.path.isdir(folder): + files = os.listdir(folder) + if ".DS_Store" in files: + files.remove(".DS_Store") + return files + return [] + +def preprocess_filename(filename): + # Remove common style indicators from the filename and return + return filename.replace("-filled.svg", "").replace("-light.svg", "").replace("-regular.svg", "") + +# Function to recursively list all unique SVG filenames without their paths +def list_concepts(folder): + concepts = set() # Use a set to avoid duplicates + for root, dirs, files in os.walk(folder): + # Filter and preprocess SVG filenames before adding to the set + for file in files: + if file.endswith('.svg') and not file.startswith('.'): + processed_file = preprocess_filename(file) + concepts.add(processed_file) + return list(concepts) # Convert set to list before returning + +# List all .svg files in the directory, including subdirectories. +def list_svg_files(folder): + svg_files = [] + for root, dirs, files in os.walk(folder): + svg_files.extend(os.path.join(root, file) for file in files if file.endswith('.svg') and not file.startswith('.')) + return svg_files + + +concepts = list_concepts("./icons") +total_concepts = len(concepts) + +# SVG List +svg_files = list_svg_files("./icons") + +# Total number of icons +total_icons = len(svg_files) + +def process_icon_sets(folders, all_concepts): + """Process each icon set to compute various metrics, update all_concepts with unique processed names.""" + data = {} + for folder in folders: + files = list_svg_files(folder) + icons = {os.path.basename(file): file for file in files} + + # no_processed_names are icons with -regular, -light, -filled + no_processed_names = {(os.path.basename(file)): file for file in files} + + # processed_names are icons without -regular, -light, -filled + processed_names = {preprocess_filename(os.path.basename(file)): file for file in files} + + data[folder] = { + "total": len(files), + "icons": set(icons.keys()), + "no_processed_names": set(no_processed_names.keys()), + "processed_names": set(processed_names.keys()), + "unique": set(), + "all_equivalence": set(), + "some_equivalence": set(), + "missing": set() + } + all_concepts.update(data[folder]["no_processed_names"]) + + for folder in folders: + current_no_processed_names = data[folder]["no_processed_names"] + data[folder]["unique"] = current_no_processed_names - set.union(*(data[f]["no_processed_names"] for f in folders if f != folder)) + data[folder]["all_equivalence"] = set.intersection(*(data[f]["no_processed_names"] for f in folders)) + for other_folder in folders: + if other_folder != folder: + data[folder]["some_equivalence"].update(current_no_processed_names & data[other_folder]["no_processed_names"]) + data[folder]["some_equivalence"] -= data[folder]["all_equivalence"] + data[folder]["missing"] = all_concepts - (data[folder]["unique"] | data[folder]["all_equivalence"] | data[folder]["some_equivalence"]) + + return data + +# Generate a color-coded bar representation for each icon set based on percentage data. +def generate_bar_representation(data, folders, bar_width=400, bar_height=8): + bar_output = [] + for folder, metrics in data.items(): + folder_data = data[folder] + + # Total per brand + total_brand_icons = folder_data['total'] + + all_equivalence_count = len(folder_data['all_equivalence']) + some_equivalence_count = len(folder_data['some_equivalence']) + unique_count = len(folder_data['unique']) + missing_count = len(folder_data['missing']) + + all_equivalence_percent = (all_equivalence_count * 100) / total_icons + some_equivalence_percent = (some_equivalence_count * 100) / total_icons + unique_percent = (unique_count * 100) / total_icons + missing_percent = (missing_count * 100) / total_icons + + all_equivalence_width = round(int((all_equivalence_percent / 100) * bar_width)) + if 0 < all_equivalence_percent < 1: + all_equivalence_width = 1 + + some_equivalence_width = round(int((some_equivalence_percent / 100) * bar_width)) + if 0 < some_equivalence_percent < 1: + some_equivalence_width = 1 + + unique_width = round(int((unique_percent / 100) * bar_width)) + if 0 < unique_percent < 1: + unique_width = 1 + + missing_width = bar_width - (unique_width + all_equivalence_width + some_equivalence_width) + if 0 < missing_percent < 1: + missing_width = 1 + + bar_parts = [] + if all_equivalence_width > 0: + bar_parts.append(f"All Equivalence") + if some_equivalence_width > 0: + bar_parts.append(f"Some Equivalence") + if unique_width > 0: + bar_parts.append(f"Unique") + if missing_width > 0: + bar_parts.append(f"Missing") + + bar_representation = f"{os.path.basename(folder).title()} " + "\n" + "".join(bar_parts) + "\n" + bar_output.append(bar_representation) + return bar_output + +def generate_markdown_table(data, folders): + global total_concepts + + """Generate markdown table representation of the data.""" + markdown = f"| ICON SET | CONCEPTS ({total_concepts}) | TOTAL ({total_icons}) | ALL EQUIVALENCE | SOME EQUIVALENCE | UNIQUE | MISSING |\n" + markdown += "| :--------- | --------: | -----: | ----------: | -------------------: | -------------------: | ------------: |\n" + + for folder in folders: + folder_name = os.path.basename(folder).title() + folder_data = data[folder] + + total_brand_icons = folder_data['total'] + + all_equivalence_count = len(folder_data['all_equivalence']) + all_equivalence_percent = f"{all_equivalence_count} ({all_equivalence_count * 100 / (total_icons):.1f}%) ![All Equivalence](https://dummyimage.com/4x12/{bar_colors['all_equivalence']}/000&text=+)" if total_icons > 0 else "0 (0%)" + some_equivalence_count = len(folder_data['some_equivalence']) + some_equivalence_percent = f"{some_equivalence_count} ({some_equivalence_count * 100 / total_icons:.1f}%) ![Some Equivalence](https://dummyimage.com/4x12/{bar_colors['some_equivalence']}/000&text=+)" if total_icons > 0 else "0 (0%)" + unique_count = len(folder_data['unique']) + unique_percent = f"{unique_count} ({unique_count * 100 / total_icons:.1f}%) ![Unique](https://dummyimage.com/4x12/{bar_colors['unique']}/000&text=+)" if total_icons > 0 else "0 (0%)" + + # ARCHIVE + # missing_count = len(folder_data['missing']) + # missing_percent = f"{missing_count}" #({missing_count * 100 / total_icons:.1f}%)" if total_icons > 0 else "0 (0%)" + + # missing_percent = f"{missing_count} ({missing_count * 100 / total_icons:.1f}%) ![Missing](https://dummyimage.com/4x12/{bar_colors['missing']}/000&text=+)" + missing_count = total_icons - total_brand_icons + # print(missing_count) + missing_percent = f"{total_icons - total_brand_icons} ({(missing_count * 100) / total_icons:.1f}%) ![Missing](https://dummyimage.com/4x12/{bar_colors['missing']}/000&text=+)" + + markdown += f"| {folder_name} | {len(folder_data['processed_names'])} | {folder_data['total']} | {all_equivalence_percent} | {some_equivalence_percent} | {unique_percent} | {missing_percent} |\n" + + # markdown += f"| | **{total_concepts}** | **{total_icons}** | | | | |\n" + markdown += "\n" + # markdown += f"
Total concepts{total_concepts}
Total icons{total_icons}
" + + + return markdown + + +def generate_icon_table(path): # Renombrar la función para que coincida con el nombre del módulo + brands = [folder for folder in os.listdir(path) if os.path.isdir(os.path.join(path, folder))] + root = os.path.basename(path) + dictionary = {} + file_content = BREAK + "| ---BRANDS--- | icon name |" + \ + BREAK + "| ---HEADER-BREAK--- |" + ":--- |" + BREAK + for brand in brands: + brand_folder = path + SLASH + brand + styles = read_folder(brand_folder) + for style in styles: + style_folder = brand_folder + SLASH + style + icons = read_folder(style_folder) + for icon in icons: + icon_name = os.path.splitext(icon)[0] + file_path = root + SLASH + brand + SLASH + \ + style + SLASH + icon_name + SVG_EXTENSION + if icon_name in dictionary: + if style not in dictionary[icon_name]: + dictionary[icon_name][style] = {brand: file_path} + else: + dictionary[icon_name][style][brand] = file_path + else: + dictionary[icon_name] = { + style: {brand: file_path} + } + + brands.remove("telefonica") + brands = ["telefonica"] + sorted(brands, reverse=True) + separator = " " + PIPE + " " + file_content = file_content.replace("---BRANDS---", separator.join(brands)) + file_content = file_content.replace("---HEADER-BREAK---", separator.join( + [":---:"] * (len(brands)))) # add (len(brands) + 2) to add svg & pdf download + + for icon_name in sorted(dictionary.keys()): + icon = dictionary[icon_name] + for style in sorted(icon.keys()): + icon_images = [] + for brand in brands: + icon_image = "![" + icon_name + \ + "](" + icon[style][brand] + \ + ") " if brand in icon[style] else " " + icon_images.append(icon_image) + row = PIPE + PIPE.join(icon_images) + PIPE + \ + ""+ "`" + icon_name + "`" + "" + \ + "[" + "![" + icon_name + "]" + \ + "(.github/resources/anchor.svg)" + \ + "]" + "(" + "#" + icon_name + ")" + PIPE + file_content += row + BREAK + + return file_content # Devolver el contenido de la tabla de iconos + + +def main(root_folder): + folders = [os.path.join(root_folder, brand) for brand in brands] + all_concepts = set() + icon_data = process_icon_sets(folders, all_concepts) + bars = generate_bar_representation(icon_data, all_concepts) + + markdown_content = "" + + # Add documentation + documentation = "![Mistica Icons](.github/resources/mistica-icons-light.svg#gh-light-mode-only)" + BREAK + "![Mistica Icons](.github/resources/mistica-icons-dark.svg#gh-dark-mode-only)" + BREAK + BREAK + "Mística Icons is a multibrand icon system that contains all icons that is working in [Mistica Design System](https://github.com/Telefonica/mistica) now. " + BREAK + BREAK + "Mistica support [Brand Factory icons](https://brandfactory.telefonica.com/document/1086#/nuestra-identidad/iconos). This set of icons are a big list of different icons and style that Brand Team worked to be used through Telefonica applications." + BREAK + BREAK + "If you have any question, please you can ask directly in the app of Microsoft Teams, in [Mistica Team](https://teams.microsoft.com/l/team/19%3ad2e3607a32ec411b8bf492f43cd0fe0c%40thread.tacv2/conversations?groupId=e265fe99-929f-45d1-8154-699649674a40&tenantId=9744600e-3e04-492e-baa1-25ec245c6f10). " + \ + BREAK + BREAK + "## Documentation" + BREAK + BREAK + "### Develop" + BREAK + BREAK + "#### iOS and Android" + BREAK + BREAK + "You can get .pdf or .svg files from this repo." + BREAK + BREAK + "#### Web" + BREAK + BREAK + \ + "Visit [Mistica Storybook](https://mistica-web.vercel.app/?path=/story/icons-catalog--catalog) to get all the detail about using Mistica Icons Library" + BREAK + BREAK + "### Design" + BREAK + BREAK + "Use Mística icons library in Figma!" + BREAK + BREAK + markdown_content += documentation + BREAK + + markdown_content += "## Equivalence status\n\n" + for bar in bars: + markdown_content += bar + "\n" + markdown_content += " " + BREAK + + # Add equivalence status table + markdown_table = generate_markdown_table(icon_data, folders) + markdown_content += markdown_table + "\n" + + legend = ( + "**Concepts**: Counts the different names of icons in the set excluding any variations in style or weight. " + + BREAK + + "**Total**: The total number of icons found in a brand set. Counting light, regular and filled weights. " + + BREAK + + "**All Equivalence**: Icons that are present in all sets. " + + BREAK + + "**Some Equivalence**: Icons that are present in some sets. " + + BREAK + + "**Unique**: Icons that only exists in this set. " + + BREAK + + "**Missing**: Missing icons with respect to other sets." + ) + + markdown_content += legend + "\n" + + markdown_content += "## Icon equivalence\n\n" + icon_table_output = generate_icon_table(root_folder) + markdown_content += icon_table_output + "\n" + + with open("./README.md", "w") as file: + file.write(markdown_content) + +if __name__ == "__main__": + root_folder = "icons" + main(root_folder) + diff --git a/.github/md-generator/md-generator.py b/.github/md-generator/md-generator.py deleted file mode 100644 index 1e35247b5a6..00000000000 --- a/.github/md-generator/md-generator.py +++ /dev/null @@ -1,239 +0,0 @@ -# !/usr/bin/python - -import os -import sys - -PIPE = "|" -SLASH = "/" -SVG_EXTENSION = ".svg" -PDF_EXTENSION = ".pdf" -BREAK = "\n" - -BAR_FILLED = "![bar_filled](.github/resources/filled.png)" -BAR_EMPTY = "![bar_empty](.github/resources/empty.png)" - -BAR_FILLED_S = "![bar_filled](.github/resources/filled-s.png)" -BAR_EMPTY_S = "![bar_empty](.github/resources/empty-s.png)" - -def read_folder(folder): - if os.path.isdir(folder): - files = os.listdir(folder) - if ".DS_Store" in files: - files.remove(".DS_Store") - return files - return [] - -# List of all icons per brand -icons_telefonica = set() -icons_o2 = set() -icons_blau = set() -icons_vivo = set() - -# Adding icons to each list -def add_icons_from_folder(folder_name, icon_set): - for root, dirs, files in os.walk(f'icons/{folder_name}/'): - for file in files: - if file.endswith(".svg"): - icon_set.add(file) - -add_icons_from_folder('telefonica', icons_telefonica) -add_icons_from_folder('o2', icons_o2) -add_icons_from_folder('blau', icons_blau) -add_icons_from_folder('vivo-new', icons_vivo) - -# Length of brand lists -len_icons_telefonica = len(icons_telefonica) -len_icons_o2 = len(icons_o2) -len_icons_blau = len(icons_blau) -len_icons_vivo = len(icons_vivo) - -# Union of all icons (no repeated!) -total_icons = sorted(set.union(icons_telefonica, icons_o2, icons_blau, icons_vivo)) - -# Total icons in integer format -len_total_icons = len(total_icons) - -# Intersections lists in integer format -telefonica_intersection = icons_telefonica & (icons_blau | icons_o2 | icons_vivo) -o2_intersection = icons_o2 & (icons_blau | icons_telefonica | icons_vivo) -blau_intersection = icons_blau & (icons_telefonica | icons_o2 | icons_vivo) -vivo_intersection = icons_vivo & (icons_telefonica | icons_o2 | icons_blau) - -# ————————————————————————————————————————————————————————————————————————— -# ————————————————————————————————————————————————————————————————————————— - -# Calculate the length of the intersection of each set with the union of the other two sets -telefonica_local_equivalence = len(icons_telefonica & (icons_o2 | icons_blau | icons_vivo)) -o2_local_equivalence = len(icons_o2 & (icons_telefonica | icons_blau | icons_vivo)) -blau_local_equivalence = len(icons_blau & (icons_telefonica | icons_o2 | icons_vivo)) -vivo_local_equivalence = len(icons_vivo & (icons_telefonica | icons_o2 | icons_blau)) - -# Calculate the local percentage for each set -telefonica_local_percentage = int(100 * telefonica_local_equivalence / len(icons_telefonica)) -o2_local_percentage = int(100 * o2_local_equivalence / len(icons_o2)) -blau_local_percentage = int(100 * blau_local_equivalence / len(icons_blau)) -vivo_local_percentage = int(100 * vivo_local_equivalence / len(icons_vivo)) - -# LOCAL BARS -# Define a helper function to calculate the local bar -def calculate_local_bar(local_percentage): - # Calculate the number of filled and empty bars needed - num_filled_bars = int(local_percentage / 10) * 2 - num_empty_bars = abs(int(local_percentage / 10) - 10) * 2 - # Construct and return the local bar - return num_filled_bars * BAR_FILLED + num_empty_bars * BAR_EMPTY - -# Calculate the local bar for each set -telefonica_local_bar = calculate_local_bar(telefonica_local_percentage) -o2_local_bar = calculate_local_bar(o2_local_percentage) -blau_local_bar = calculate_local_bar(blau_local_percentage) -vivo_local_bar = calculate_local_bar(vivo_local_percentage) - -# Composition of LOCAL (X / Y) for markdown -# Define a helper function to calculate the local comparison string -def calculate_local_comparison(local_equivalence, total_icons): - return f" ({local_equivalence} / {len(total_icons)})" - -# Calculate the local comparison string for each set -comp_local_telefonica = calculate_local_comparison(telefonica_local_equivalence, icons_telefonica) -comp_local_o2 = calculate_local_comparison(o2_local_equivalence, icons_o2) -comp_local_blau = calculate_local_comparison(blau_local_equivalence, icons_blau) -comp_local_vivo = calculate_local_comparison(vivo_local_equivalence, icons_vivo) - -# Composition of LOCAL BAR + (X / Y) for markdown -# Define a helper function to calculate the local comparison string -def calculate_local_string(name, local_bar, local_percentage, local_comparison): - return f"{name} set {BREAK}{local_bar}    {local_percentage}%{local_comparison} `local` " - -# Calculate the local string for each set -telefonica_local = calculate_local_string("Telefónica", telefonica_local_bar, telefonica_local_percentage, comp_local_telefonica) -o2_local = calculate_local_string("O₂", o2_local_bar, o2_local_percentage, comp_local_o2) -blau_local = calculate_local_string("Blau", blau_local_bar, blau_local_percentage, comp_local_blau) -vivo_local = calculate_local_string("Vivo", vivo_local_bar, vivo_local_percentage, comp_local_vivo) - - -# ————————————————————————————————————————————————————————————————————————— -# ————————————————————————————————————————————————————————————————————————— - -# [Global] Percentage of number of icons with the total of icons -# Define a helper function to calculate the global percentage -def calculate_global_percentage(name, num_icons, total_icons): - return int((100 * num_icons) / total_icons) - -# Calculate the global percentage for each set -telefonica_global_percentage = calculate_global_percentage("Telefónica", len_icons_telefonica, len_total_icons) -o2_global_percentage = calculate_global_percentage("O₂", len_icons_o2, len_total_icons) -blau_global_percentage = calculate_global_percentage("Blau", len_icons_blau, len_total_icons) -vivo_global_percentage = calculate_global_percentage("Vivo", len_icons_vivo, len_total_icons) - -print(telefonica_global_percentage) - -# Composition of GLOBAL (X / Y) for markdown -comp_global_telefonica, comp_global_o2, comp_global_blau, comp_global_vivo = [f" ({len_icons} / {len_total_icons})" for len_icons in [len_icons_telefonica, len_icons_o2, len_icons_blau, len_icons_vivo]] - -# GLOBAL BARS -def generate_bars_and_percentage(len_icons, len_total_icons): - percentage = int((100 * len_icons) / len_total_icons) - bar = (int(percentage / 10) * 2) * BAR_FILLED_S + \ - BAR_EMPTY_S * (abs(int(percentage / 10) - 10) * 2) - composition = " " + \ - "(" + str(len_icons) + " / " + str(len(total_icons)) + ")" - return bar, percentage, composition - -telefonica_global_bar, telefonica_global_percentage, comp_global_telefonica = generate_bars_and_percentage(len_icons_telefonica, len_total_icons) -o2_global_bar, o2_global_percentage, comp_global_o2 = generate_bars_and_percentage(len_icons_o2, len_total_icons) -blau_global_bar, blau_global_percentage, comp_global_blau = generate_bars_and_percentage(len_icons_blau, len_total_icons) -vivo_global_bar, vivo_global_percentage, comp_global_vivo = generate_bars_and_percentage(len_icons_vivo, len_total_icons) - -# Composition of GLOBAL BAR + (X / Y) for markdown -def create_bar_string(percentage, comp_string): - bar = (int(percentage / 10) * 2) * BAR_FILLED_S + \ - BAR_EMPTY_S * (abs(int(percentage / 10) - 10) * 2) - return f"{bar}    {percentage}%{comp_string} `global` " - -telefonica_global = create_bar_string(telefonica_global_percentage, comp_global_telefonica) -o2_global = create_bar_string(o2_global_percentage, comp_global_o2) -blau_global = create_bar_string(blau_global_percentage, comp_global_blau) -vivo_global = create_bar_string(vivo_global_percentage, comp_global_vivo) - -# ————————————————————————————————————————————————————————————————————————— -# ————————————————————————————————————————————————————————————————————————— - -if __name__ == '__main__': - path = sys.argv[1] - brands = [folder for folder in os.listdir(path) if os.path.isdir(os.path.join(path, folder))] - root = os.path.basename(path) - dictionary = {} - file_content = "![Mistica Icons](.github/resources/mistica-icons-light.svg#gh-light-mode-only)" + BREAK + "![Mistica Icons](.github/resources/mistica-icons-dark.svg#gh-dark-mode-only)" + BREAK + BREAK + "## What is this? " + BREAK + BREAK + "Mística Icons is a multibrand icon system that contains all icons that is working in [Mistica Design System](https://github.com/Telefonica/mistica) now. " + BREAK + BREAK + "Mistica support [Brand Factory icons](https://brandfactory.telefonica.com/document/1086#/nuestra-identidad/iconos). This set of icons are a big list of different icons and style that Brand Team worked to be used through Telefonica applications." + BREAK + BREAK + "If you have any question, please you can ask directly in the app of Microsoft Teams, in [Mistica Team](https://teams.microsoft.com/l/team/19%3ad2e3607a32ec411b8bf492f43cd0fe0c%40thread.tacv2/conversations?groupId=e265fe99-929f-45d1-8154-699649674a40&tenantId=9744600e-3e04-492e-baa1-25ec245c6f10). " + \ - BREAK + BREAK + "## Documentation" + BREAK + BREAK + "### Develop" + BREAK + BREAK + "#### iOS and Android" + BREAK + BREAK + "You can get .pdf or .svg files from this repo." + BREAK + BREAK + "#### Web" + BREAK + BREAK + \ - "Visit [Mistica Storybook](https://mistica-web.vercel.app/?path=/story/icons-catalog--catalog) to get all the detail about using Mistica Icons Library" + BREAK + BREAK + "### Design" + BREAK + BREAK + "Use Mística icons library in Figma!" + BREAK + BREAK + \ - "## Icon equivalence status" + BREAK + BREAK + "**Local** = Icon equivalence in this set " + BREAK + "**Global** = Icon set equivalence with total icons" + BREAK + BREAK + "---telefonica_local_BAR---" + BREAK + "---telefonica_global_BAR---" + BREAK + BREAK + "---o2_local_BAR---" + BREAK + "---o2_global_BAR---" + BREAK + BREAK + "---blau_local_BAR---" + BREAK + "---blau_global_BAR---" + BREAK + BREAK + "---vivo_local_BAR---" + BREAK + "---vivo_global_BAR---" + BREAK + BREAK + \ - "## Icons" + BREAK + BREAK + "| ---BRANDS--- | icon name |" + \ - BREAK + "| ---HEADER-BREAK--- |" + ":--- |" + BREAK - for brand in brands: - brand_folder = path + SLASH + brand - styles = read_folder(brand_folder) - for style in styles: - style_folder = brand_folder + SLASH + style - icons = read_folder(style_folder) - for icon in icons: - icon_name = os.path.splitext(icon)[0] - file_path = root + SLASH + brand + SLASH + \ - style + SLASH + icon_name + SVG_EXTENSION - # file_path_pdf = root + SLASH + brand + SLASH + style + SLASH + icon_name + PDF_EXTENSION - if icon_name in dictionary: - if style not in dictionary[icon_name]: - dictionary[icon_name][style] = {brand: file_path} - else: - dictionary[icon_name][style][brand] = file_path - else: - dictionary[icon_name] = { - style: {brand: file_path} - } - - brands.remove("telefonica") - brands = ["telefonica"] + sorted(brands, reverse=True) - separator = " " + PIPE + " " - file_content = file_content.replace( - "---telefonica_global_BAR---", (telefonica_global)) - file_content = file_content.replace( - "---telefonica_local_BAR---", (telefonica_local)) - file_content = file_content.replace("---o2_global_BAR---", (o2_global)) - file_content = file_content.replace( - "---o2_local_BAR---", (o2_local)) - file_content = file_content.replace( - "---blau_global_BAR---", (blau_global)) - file_content = file_content.replace( - "---blau_local_BAR---", (blau_local)) - file_content = file_content.replace( - "---vivo_global_BAR---", (vivo_global)) - file_content = file_content.replace( - "---vivo_local_BAR---", (vivo_local)) - file_content = file_content.replace("---BRANDS---", separator.join(brands)) - file_content = file_content.replace("---HEADER-BREAK---", separator.join( - [":---:"] * (len(brands)))) # add (len(brands) + 2) to add svg & pdf download - - for icon_name in sorted(dictionary.keys()): - icon = dictionary[icon_name] - for style in sorted(icon.keys()): - icon_images = [] - for brand in brands: - icon_image = "![" + icon_name + \ - "](" + icon[style][brand] + \ - ") " if brand in icon[style] else " " - icon_images.append(icon_image) - # row = "| telefonica | O2 | my_icon_light | - row = PIPE + PIPE.join(icon_images) + PIPE + \ - ""+ "`" + icon_name + "`" + "" + \ - "[" + "![" + icon_name + "]" + \ - "(.github/resources/anchor.svg)" + \ - "]" + "(" + "#" + icon_name + ")" + PIPE - # + "[]" + "(" + file_path + ")" + "[]" + "(" + file_path_pdf + ")" + PIPE + "[]" + "(" + file_path + ")" + "[]" + "(" + file_path_pdf + ")" - file_content += row + BREAK - - output_file_path = "./README.md" - print(output_file_path) - print(file_content) - file = open(output_file_path, "w+") - file.write(file_content) - file.close() diff --git a/.github/resources/empty-s.png b/.github/resources/empty-s.png deleted file mode 100644 index 55c613e7770..00000000000 Binary files a/.github/resources/empty-s.png and /dev/null differ diff --git a/.github/resources/empty.png b/.github/resources/empty.png deleted file mode 100644 index 8a28a289a62..00000000000 Binary files a/.github/resources/empty.png and /dev/null differ diff --git a/.github/resources/filled-s.png b/.github/resources/filled-s.png deleted file mode 100644 index 6ca56991178..00000000000 Binary files a/.github/resources/filled-s.png and /dev/null differ diff --git a/.github/resources/filled.png b/.github/resources/filled.png deleted file mode 100644 index 957c2e3d41c..00000000000 Binary files a/.github/resources/filled.png and /dev/null differ diff --git a/.github/workflows/auto-generator.yml b/.github/workflows/auto-generator.yml index 2d3461cc073..f1284eeb226 100644 --- a/.github/workflows/auto-generator.yml +++ b/.github/workflows/auto-generator.yml @@ -4,7 +4,9 @@ on: workflow_dispatch: push: paths: - - ".github/md-generator/md-generator.py" + - ".github/md-generator/generate_markdown.py" + - ".github/md-generator/generate_icon_table.py" + - ".github/md-generator/generate_graph.py" - ".github/workflows/auto-generator.yml" - "icons/" @@ -18,7 +20,7 @@ jobs: - name: Get branch name uses: rlespinasse/github-slug-action@v3.x - - run: sudo python3 .github/md-generator/md-generator.py icons + - run: sudo python3 .github/md-generator/generate_markdown.py icons - name: Commit & Push in ${{ env.GITHUB_REF_SLUG_URL }} run: | diff --git a/.gitignore b/.gitignore index 54f81a05026..631479de5ac 100644 --- a/.gitignore +++ b/.gitignore @@ -52,4 +52,5 @@ vivo-filled.json #figma-export-icons vivo-regular.json #figma-export-icons -vivo-light.json \ No newline at end of file +vivo-light.json +*.pyc diff --git a/README.md b/README.md index 1e4d2e6a75b..4db67f23d1b 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ ![Mistica Icons](.github/resources/mistica-icons-light.svg#gh-light-mode-only) ![Mistica Icons](.github/resources/mistica-icons-dark.svg#gh-dark-mode-only) -## What is this? - Mística Icons is a multibrand icon system that contains all icons that is working in [Mistica Design System](https://github.com/Telefonica/mistica) now. Mistica support [Brand Factory icons](https://brandfactory.telefonica.com/document/1086#/nuestra-identidad/iconos). This set of icons are a big list of different icons and style that Brand Team worked to be used through Telefonica applications. @@ -25,28 +23,38 @@ Visit [Mistica Storybook](https://mistica-web.vercel.app/?path=/story/icons-cata Use Mística icons library in Figma! -## Icon equivalence status -**Local** = Icon equivalence in this set -**Global** = Icon set equivalence with total icons +## Equivalence status + +Telefonica +All EquivalenceSome EquivalenceUniqueMissing + +O2 +All EquivalenceSome EquivalenceUniqueMissing -Telefónica set -![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)    38% (454 / 1193) `local` -![bar_filled](.github/resources/filled-s.png)![bar_filled](.github/resources/filled-s.png)![bar_filled](.github/resources/filled-s.png)![bar_filled](.github/resources/filled-s.png)![bar_filled](.github/resources/filled-s.png)![bar_filled](.github/resources/filled-s.png)![bar_filled](.github/resources/filled-s.png)![bar_filled](.github/resources/filled-s.png)![bar_filled](.github/resources/filled-s.png)![bar_filled](.github/resources/filled-s.png)![bar_filled](.github/resources/filled-s.png)![bar_filled](.github/resources/filled-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)    69% (1193 / 1709) `global` +Vivo-New +All EquivalenceSome EquivalenceUniqueMissing -O₂ set -![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)    49% (446 / 894) `local` -![bar_filled](.github/resources/filled-s.png)![bar_filled](.github/resources/filled-s.png)![bar_filled](.github/resources/filled-s.png)![bar_filled](.github/resources/filled-s.png)![bar_filled](.github/resources/filled-s.png)![bar_filled](.github/resources/filled-s.png)![bar_filled](.github/resources/filled-s.png)![bar_filled](.github/resources/filled-s.png)![bar_filled](.github/resources/filled-s.png)![bar_filled](.github/resources/filled-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)    52% (894 / 1709) `global` +Blau +All EquivalenceSome EquivalenceUniqueMissing -Blau set -![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)    91% (56 / 61) `local` -![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)    3% (61 / 1709) `global` + +| ICON SET | CONCEPTS (599) | TOTAL (2247) | ALL EQUIVALENCE | SOME EQUIVALENCE | UNIQUE | MISSING | +| :--------- | --------: | -----: | ----------: | -------------------: | -------------------: | ------------: | +| Telefonica | 420 | 1193 | 3 (0.1%) ![All Equivalence](https://dummyimage.com/4x12/0066FF/000&text=+) | 451 (20.1%) ![Some Equivalence](https://dummyimage.com/4x12/EAC344/000&text=+) | 739 (32.9%) ![Unique](https://dummyimage.com/4x12/59C2C9/000&text=+) | 1054 (46.9%) ![Missing](https://dummyimage.com/4x12/D1D5E4/000&text=+) | +| O2 | 302 | 894 | 3 (0.1%) ![All Equivalence](https://dummyimage.com/4x12/0066FF/000&text=+) | 443 (19.7%) ![Some Equivalence](https://dummyimage.com/4x12/EAC344/000&text=+) | 448 (19.9%) ![Unique](https://dummyimage.com/4x12/59C2C9/000&text=+) | 1353 (60.2%) ![Missing](https://dummyimage.com/4x12/D1D5E4/000&text=+) | +| Vivo-New | 52 | 99 | 3 (0.1%) ![All Equivalence](https://dummyimage.com/4x12/0066FF/000&text=+) | 42 (1.9%) ![Some Equivalence](https://dummyimage.com/4x12/EAC344/000&text=+) | 54 (2.4%) ![Unique](https://dummyimage.com/4x12/59C2C9/000&text=+) | 2148 (95.6%) ![Missing](https://dummyimage.com/4x12/D1D5E4/000&text=+) | +| Blau | 57 | 61 | 3 (0.1%) ![All Equivalence](https://dummyimage.com/4x12/0066FF/000&text=+) | 53 (2.4%) ![Some Equivalence](https://dummyimage.com/4x12/EAC344/000&text=+) | 5 (0.2%) ![Unique](https://dummyimage.com/4x12/59C2C9/000&text=+) | 2186 (97.3%) ![Missing](https://dummyimage.com/4x12/D1D5E4/000&text=+) | -Vivo set -![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_filled](.github/resources/filled.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)![bar_empty](.github/resources/empty.png)    45% (45 / 99) `local` -![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)![bar_empty](.github/resources/empty-s.png)    5% (99 / 1709) `global` -## Icons +**Concepts**: Counts the different names of icons in the set excluding any variations in style or weight. +**Total**: The total number of icons found in a brand set. Counting light, regular and filled weights. +**All Equivalence**: Icons that are present in all sets. +**Some Equivalence**: Icons that are present in some sets. +**Unique**: Icons that only exists in this set. +**Missing**: Missing icons with respect to other sets. +## Icon equivalence + | telefonica | vivo-new | o2 | blau | icon name | | :---: | :---: | :---: | :---: |:--- | @@ -1759,3 +1767,4 @@ Vivo set | | |![world-device-filled](icons/o2/filled/world-device-filled.svg) | |`world-device-filled`[![world-device-filled](.github/resources/anchor.svg)](#world-device-filled)| | | |![world-device-light](icons/o2/light/world-device-light.svg) | |`world-device-light`[![world-device-light](.github/resources/anchor.svg)](#world-device-light)| | | |![world-device-regular](icons/o2/regular/world-device-regular.svg) | |`world-device-regular`[![world-device-regular](.github/resources/anchor.svg)](#world-device-regular)| +