Spaces:
				
			
			
	
			
			
					
		Running
		
	
	
	
			
			
	
	
	
	
		
		
					
		Running
		
	Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | 
         @@ -342,7 +342,6 @@ class FontMoodGenerator: 
     | 
|
| 342 | 
         | 
| 343 | 
         
             
                    css_code = f"""/* Generated Font Palette CSS */
         
     | 
| 344 | 
         
             
            {font_imports}
         
     | 
| 345 | 
         
            -
             
     | 
| 346 | 
         
             
            /* Font Variables */
         
     | 
| 347 | 
         
             
            :root {{"""
         
     | 
| 348 | 
         | 
| 
         @@ -354,7 +353,6 @@ class FontMoodGenerator: 
     | 
|
| 354 | 
         | 
| 355 | 
         
             
                    css_code += """
         
     | 
| 356 | 
         
             
            }
         
     | 
| 357 | 
         
            -
             
     | 
| 358 | 
         
             
            /* Usage Examples */
         
     | 
| 359 | 
         
             
            .heading { font-family: var(--font-1); }
         
     | 
| 360 | 
         
             
            .body-text { font-family: var(--font-2); }
         
     | 
| 
         @@ -604,7 +602,7 @@ def create_ui(generator: FontMoodGenerator): 
     | 
|
| 604 | 
         
             
                                outputs=[palette_html_hidden, font_data_hidden, theme_css_hidden, theme_css_display, walkthrough]
         
     | 
| 605 | 
         
             
                            )
         
     | 
| 606 | 
         | 
| 607 | 
         
            -
                    # Static CSS for font cards  
     | 
| 608 | 
         
             
                    gr.HTML("""
         
     | 
| 609 | 
         
             
                        <style>
         
     | 
| 610 | 
         
             
                            .font-palette-container {
         
     | 
| 
         @@ -612,9 +610,10 @@ def create_ui(generator: FontMoodGenerator): 
     | 
|
| 612 | 
         
             
                                align-items: center; width: 100%;
         
     | 
| 613 | 
         
             
                            }
         
     | 
| 614 | 
         
             
                            .font-card {
         
     | 
| 615 | 
         
            -
                                border: 2px solid #e0e0e0;  
     | 
| 
         | 
|
| 616 | 
         
             
                                padding: 10px; width: 90%; max-width: 600px;
         
     | 
| 617 | 
         
            -
                                background:  
     | 
| 618 | 
         
             
                                box-shadow: 0 2px 6px rgba(0,0,0,0.1);
         
     | 
| 619 | 
         
             
                                transition: all 0.3s ease;
         
     | 
| 620 | 
         
             
                            }
         
     | 
| 
         @@ -627,7 +626,9 @@ def create_ui(generator: FontMoodGenerator): 
     | 
|
| 627 | 
         
             
                                align-items: center; margin-bottom: 8px;
         
     | 
| 628 | 
         
             
                            }
         
     | 
| 629 | 
         
             
                            .font-header h3 {
         
     | 
| 630 | 
         
            -
                                margin: 0;  
     | 
| 
         | 
|
| 
         | 
|
| 631 | 
         
             
                            }
         
     | 
| 632 | 
         
             
                            .font-score {
         
     | 
| 633 | 
         
             
                                background: #3498db; color: white; padding: 3px 6px;
         
     | 
| 
         @@ -635,19 +636,84 @@ def create_ui(generator: FontMoodGenerator): 
     | 
|
| 635 | 
         
             
                            }
         
     | 
| 636 | 
         
             
                            .font-sample {
         
     | 
| 637 | 
         
             
                                font-size: 18px; line-height: 1.2; margin: 8px 0;
         
     | 
| 638 | 
         
            -
                                padding: 8px;  
     | 
| 639 | 
         
            -
                                 
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 640 | 
         
             
                                min-height: 30px; display: flex; align-items: center;
         
     | 
| 641 | 
         
             
                            }
         
     | 
| 642 | 
         
             
                            .font-details {
         
     | 
| 643 | 
         
             
                                display: flex; flex-direction: column; gap: 4px;
         
     | 
| 644 | 
         
             
                            }
         
     | 
| 645 | 
         
             
                            .font-family {
         
     | 
| 646 | 
         
            -
                                font-weight: bold;  
     | 
| 
         | 
|
| 
         | 
|
| 647 | 
         
             
                                text-transform: uppercase; letter-spacing: 1px;
         
     | 
| 648 | 
         
             
                            }
         
     | 
| 649 | 
         
             
                            .font-description {
         
     | 
| 650 | 
         
            -
                                color: #5d6d7e;  
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 651 | 
         
             
                            }
         
     | 
| 652 | 
         
             
                        </style>
         
     | 
| 653 | 
         
             
                    """)
         
     | 
| 
         | 
|
| 342 | 
         | 
| 343 | 
         
             
                    css_code = f"""/* Generated Font Palette CSS */
         
     | 
| 344 | 
         
             
            {font_imports}
         
     | 
| 
         | 
|
| 345 | 
         
             
            /* Font Variables */
         
     | 
| 346 | 
         
             
            :root {{"""
         
     | 
| 347 | 
         | 
| 
         | 
|
| 353 | 
         | 
| 354 | 
         
             
                    css_code += """
         
     | 
| 355 | 
         
             
            }
         
     | 
| 
         | 
|
| 356 | 
         
             
            /* Usage Examples */
         
     | 
| 357 | 
         
             
            .heading { font-family: var(--font-1); }
         
     | 
| 358 | 
         
             
            .body-text { font-family: var(--font-2); }
         
     | 
| 
         | 
|
| 602 | 
         
             
                                outputs=[palette_html_hidden, font_data_hidden, theme_css_hidden, theme_css_display, walkthrough]
         
     | 
| 603 | 
         
             
                            )
         
     | 
| 604 | 
         | 
| 605 | 
         
            +
                    # Static CSS for font cards with DARK THEME SUPPORT
         
     | 
| 606 | 
         
             
                    gr.HTML("""
         
     | 
| 607 | 
         
             
                        <style>
         
     | 
| 608 | 
         
             
                            .font-palette-container {
         
     | 
| 
         | 
|
| 610 | 
         
             
                                align-items: center; width: 100%;
         
     | 
| 611 | 
         
             
                            }
         
     | 
| 612 | 
         
             
                            .font-card {
         
     | 
| 613 | 
         
            +
                                border: 2px solid var(--border-color-primary, #e0e0e0); 
         
     | 
| 614 | 
         
            +
                                border-radius: 8px;
         
     | 
| 615 | 
         
             
                                padding: 10px; width: 90%; max-width: 600px;
         
     | 
| 616 | 
         
            +
                                background: var(--background-fill-primary, #ffffff);
         
     | 
| 617 | 
         
             
                                box-shadow: 0 2px 6px rgba(0,0,0,0.1);
         
     | 
| 618 | 
         
             
                                transition: all 0.3s ease;
         
     | 
| 619 | 
         
             
                            }
         
     | 
| 
         | 
|
| 626 | 
         
             
                                align-items: center; margin-bottom: 8px;
         
     | 
| 627 | 
         
             
                            }
         
     | 
| 628 | 
         
             
                            .font-header h3 {
         
     | 
| 629 | 
         
            +
                                margin: 0; 
         
     | 
| 630 | 
         
            +
                                color: var(--body-text-color, #2c3e50); 
         
     | 
| 631 | 
         
            +
                                font-size: 1.1em;
         
     | 
| 632 | 
         
             
                            }
         
     | 
| 633 | 
         
             
                            .font-score {
         
     | 
| 634 | 
         
             
                                background: #3498db; color: white; padding: 3px 6px;
         
     | 
| 
         | 
|
| 636 | 
         
             
                            }
         
     | 
| 637 | 
         
             
                            .font-sample {
         
     | 
| 638 | 
         
             
                                font-size: 18px; line-height: 1.2; margin: 8px 0;
         
     | 
| 639 | 
         
            +
                                padding: 8px; 
         
     | 
| 640 | 
         
            +
                                background: var(--background-fill-secondary, #f8f9fa); 
         
     | 
| 641 | 
         
            +
                                border-radius: 6px;
         
     | 
| 642 | 
         
            +
                                border-left: 3px solid #3498db; 
         
     | 
| 643 | 
         
            +
                                color: var(--body-text-color, #2c3e50);
         
     | 
| 644 | 
         
             
                                min-height: 30px; display: flex; align-items: center;
         
     | 
| 645 | 
         
             
                            }
         
     | 
| 646 | 
         
             
                            .font-details {
         
     | 
| 647 | 
         
             
                                display: flex; flex-direction: column; gap: 4px;
         
     | 
| 648 | 
         
             
                            }
         
     | 
| 649 | 
         
             
                            .font-family {
         
     | 
| 650 | 
         
            +
                                font-weight: bold; 
         
     | 
| 651 | 
         
            +
                                color: var(--body-text-color-subdued, #7f8c8d); 
         
     | 
| 652 | 
         
            +
                                font-size: 0.8em;
         
     | 
| 653 | 
         
             
                                text-transform: uppercase; letter-spacing: 1px;
         
     | 
| 654 | 
         
             
                            }
         
     | 
| 655 | 
         
             
                            .font-description {
         
     | 
| 656 | 
         
            +
                                color: var(--body-text-color-subdued, #5d6d7e); 
         
     | 
| 657 | 
         
            +
                                font-size: 0.85em; line-height: 1.3;
         
     | 
| 658 | 
         
            +
                            }
         
     | 
| 659 | 
         
            +
                            
         
     | 
| 660 | 
         
            +
                            /* Dark theme fallback using media query */
         
     | 
| 661 | 
         
            +
                            @media (prefers-color-scheme: dark) {
         
     | 
| 662 | 
         
            +
                                .font-card {
         
     | 
| 663 | 
         
            +
                                    border-color: #4a5568;
         
     | 
| 664 | 
         
            +
                                    background: #2d3748;
         
     | 
| 665 | 
         
            +
                                }
         
     | 
| 666 | 
         
            +
                                .font-header h3 {
         
     | 
| 667 | 
         
            +
                                    color: #e2e8f0;
         
     | 
| 668 | 
         
            +
                                }
         
     | 
| 669 | 
         
            +
                                .font-sample {
         
     | 
| 670 | 
         
            +
                                    background: #4a5568;
         
     | 
| 671 | 
         
            +
                                    color: #e2e8f0;
         
     | 
| 672 | 
         
            +
                                }
         
     | 
| 673 | 
         
            +
                                .font-family {
         
     | 
| 674 | 
         
            +
                                    color: #a0aec0;
         
     | 
| 675 | 
         
            +
                                }
         
     | 
| 676 | 
         
            +
                                .font-description {
         
     | 
| 677 | 
         
            +
                                    color: #cbd5e0;
         
     | 
| 678 | 
         
            +
                                }
         
     | 
| 679 | 
         
            +
                            }
         
     | 
| 680 | 
         
            +
                            
         
     | 
| 681 | 
         
            +
                            /* Additional Gradio dark theme support */
         
     | 
| 682 | 
         
            +
                            .dark .font-card {
         
     | 
| 683 | 
         
            +
                                border-color: #4a5568;
         
     | 
| 684 | 
         
            +
                                background: #2d3748;
         
     | 
| 685 | 
         
            +
                            }
         
     | 
| 686 | 
         
            +
                            .dark .font-header h3 {
         
     | 
| 687 | 
         
            +
                                color: #e2e8f0;
         
     | 
| 688 | 
         
            +
                            }
         
     | 
| 689 | 
         
            +
                            .dark .font-sample {
         
     | 
| 690 | 
         
            +
                                background: #4a5568;
         
     | 
| 691 | 
         
            +
                                color: #e2e8f0;
         
     | 
| 692 | 
         
            +
                            }
         
     | 
| 693 | 
         
            +
                            .dark .font-family {
         
     | 
| 694 | 
         
            +
                                color: #a0aec0;
         
     | 
| 695 | 
         
            +
                            }
         
     | 
| 696 | 
         
            +
                            .dark .font-description {
         
     | 
| 697 | 
         
            +
                                color: #cbd5e0;
         
     | 
| 698 | 
         
            +
                            }
         
     | 
| 699 | 
         
            +
                            
         
     | 
| 700 | 
         
            +
                            /* Force text colors for better compatibility */
         
     | 
| 701 | 
         
            +
                            html[data-theme="dark"] .font-card {
         
     | 
| 702 | 
         
            +
                                border-color: #4a5568 !important;
         
     | 
| 703 | 
         
            +
                                background: #2d3748 !important;
         
     | 
| 704 | 
         
            +
                            }
         
     | 
| 705 | 
         
            +
                            html[data-theme="dark"] .font-header h3 {
         
     | 
| 706 | 
         
            +
                                color: #e2e8f0 !important;
         
     | 
| 707 | 
         
            +
                            }
         
     | 
| 708 | 
         
            +
                            html[data-theme="dark"] .font-sample {
         
     | 
| 709 | 
         
            +
                                background: #4a5568 !important;
         
     | 
| 710 | 
         
            +
                                color: #e2e8f0 !important;
         
     | 
| 711 | 
         
            +
                            }
         
     | 
| 712 | 
         
            +
                            html[data-theme="dark"] .font-family {
         
     | 
| 713 | 
         
            +
                                color: #a0aec0 !important;
         
     | 
| 714 | 
         
            +
                            }
         
     | 
| 715 | 
         
            +
                            html[data-theme="dark"] .font-description {
         
     | 
| 716 | 
         
            +
                                color: #cbd5e0 !important;
         
     | 
| 717 | 
         
             
                            }
         
     | 
| 718 | 
         
             
                        </style>
         
     | 
| 719 | 
         
             
                    """)
         
     |