December 04, 2020, 11:57:55 AM

Author Topic: [bb] CSS link color gen by Yo! Wazzup? [ 1+ years ago ]  (Read 484 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bb] CSS link color gen by Yo! Wazzup? [ 1+ years ago ]
« on: June 29, 2017, 12:28:38 AM »
Title : CSS link color gen
Author : Yo! Wazzup?
Posted : 1+ years ago

Description : Well, here you go.

When I get a good GUI with checkboxes I'll be able to add CAPS, lowercase, highlighting, and more :)

(B3d, BB2D)


Code :
Code: BlitzBasic
  1. Graphics 800,600,0,2 ;Set the graphics
  2.  
  3. Global quote$=Chr(34) ;Make a "quote" variable so I can add quotes to the Print function.
  4.  
  5. Print "Please put all colors in hexadecimal format and add a # before every Hex number." ;Tell the user that you need to use a Hex color with a # before it for this to work
  6. color_of_link$=Input("Color of every link on page? ") ;Ask what color every link should be
  7. vlink_of_link$=Input("Color of every visited link on page? ") ;Ask what color every visited link should be
  8. alink_of_link$=Input("Color of every active link on page? ") ;Ask what color every Active link on the page should be
  9. hover_color_of_link$=Input("Color of every link being hovered over with mouse? ") ;Ask what color every link being hovered over by the mouse should be.
  10. css_file_name$=Input("Name of .css file? ") ;And finally, ask what the name of the css file should be.
  11.  
  12. Cls ;Clear the screen
  13.  
  14. Locate 0,0 ;Set the Print and Input location to 0,0
  15.  
  16.  
  17. Print "Writing to text file. Please wait." ;Tell the user that the text file is being written to. Normally the user can not see this message because the file writing process is so fast.
  18.  
  19. If Right(css_file_name, 4) = ".css" Then ;Check to see if the user entered the .css extention already
  20.         css_file=WriteFile(css_file_name) ;If the user did, write the file.
  21. Else ;If the user didn't, write the file PLUS add the extension of .css
  22.         css_file_name = css_file_name + ".css"
  23.         css_file=WriteFile(css_file_name)
  24. EndIf
  25.  
  26. ;Write the CSS code to the file
  27. WriteLine(css_file, "a:link {color: " + color_of_link + " }")
  28. WriteLine(css_file, "a:visited {color: " + vlink_of_link + " }")
  29. WriteLine(css_file, "a:hover {color: " + hover_color_of_link + " }")
  30. WriteLine(css_file, "a:active {color: " + alink_of_link + " }")
  31.  
  32. CloseFile(css_file) ;Close the file
  33.  
  34. Cls ;Clear the screen
  35.  
  36. Locate 0,0 ;Set the Print and Input location to 0,0
  37.  
  38. Print "File writing complete!" ;Tell the user that the "writing to the file" process is complete
  39.  
  40. ;Give the user instructions on how to use the .css file
  41. Print "First, make sure " + css_file_name + " is in the same directory as your html file."
  42. Print "Second, type the following into the head section of the html file."
  43. Print
  44. Print "<link rel=" + quote + "stylesheet" + quote + " type=" + quote + "text/css" + quote + " href=" + quote + css_file_name + quote + ">"
  45. Print
  46. Print "Please press esc to quit."
  47.  
  48. ;Wait for the ESC key to be hit before ending the program
  49. While Not KeyDown(1)
  50. Wend
  51. End


Comments : none...

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal