# Code::Blocks Fortran: theme issue

**URL:** <https://fortran-lang.discourse.group/t/code-blocks-fortran-theme-issue/2099>\
**Category:** Uncategorized\
**Created:** [October 17, 2021, 4:41am UTC](https://fortran-lang.discourse.group/t/code-blocks-fortran-theme-issue/2099 "2021-10-17T04:41:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Uendo](https://avatars.discourse-cdn.com/v4/letter/u/ed655f/32.png) [@Uendo](https://fortran-lang.discourse.group/u/Uendo)\
**Post date:** [October 17, 2021, 4:41am UTC](https://fortran-lang.discourse.group/t/code-blocks-fortran-theme-issue/2099/1 "2021-10-17T04:41:55Z")

</div>

Hi.

I’ve been using Geany to code for now, but I’m tired of its limitations. I’ve seen [Code::Blocks Fortran](https://cbfortran.sourceforge.io/) being recommended a few times here, so I wanted to give it a try. However, I’m currently on Linux Mint 20.2 (XFCE) and I’m always using the dark theme. The problem is that Code::Blocks does not have a dark theme at all, so I think that Linux Mint forces a GTK theme on it, and the result is quite distracting, as shown below:

 ![Screenshot_2021-10-17_01-01-06](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/1X/f3e78320a162a949d1ef749e91338ced72ea604a.png)

Does anybody know how I can possibly solve this? Are there any better alternatives? I’ve gone through quite a few threads about IDE recommendations on this Discourse, and C::B and Eclipse were the most recommended (libre) IDEs.

I truly want to give Code::Blocks a try; the features [listed here](https://www.youtube.com/watch?v=M1RwVGGSAgE) look great, but this default theme is an unnecessary annoyance. I’ve already tried Eclipse, but it hangs frequently on my computer.

Does anybody have any suggestions on how I could either solve this issue or move to another IDE/text editor? I’d like to give Emacs a try as well. The main feature I’m looking for is an implementation of VS Code’s hover/intellisense, or “pop-up documentation” while inputting the arguments of a procedure.

Thank you either way.

---

<div class="post-metadata">

**Author:** ![fortran4r](https://avatars.discourse-cdn.com/v4/letter/f/9de0a6/32.png) [@fortran4r](https://fortran-lang.discourse.group/u/fortran4r)\
**Post date:** [October 17, 2021, 4:53am UTC](https://fortran-lang.discourse.group/t/code-blocks-fortran-theme-issue/2099/2 "2021-10-17T04:53:03Z")

</div>

I haven’t used Code::Blocks for a while, but I believe it should be quite straightforward to change the theme by toggling its settings. I use Geany and Gedit. Could you elaborate on the limitations of Geany as a Fortran editor/IDE? I find it quite powerful.

In terms of IDE, you can also try VSCode:

> **[Modern Fortran - Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=krvajalm.linter-gfortran)**
>
> Extension for Visual Studio Code - Modern Fortran language support, including syntax highlighting and error detection.

My personal experience is that VSCode is much slower than Geany and Code::Blocks, which are based on Scintilla.

---

<div class="post-metadata">

**Author:** ![Uendo](https://avatars.discourse-cdn.com/v4/letter/u/ed655f/32.png) [@Uendo](https://fortran-lang.discourse.group/u/Uendo)\
**Post date:** [October 17, 2021, 5:04am UTC](https://fortran-lang.discourse.group/t/code-blocks-fortran-theme-issue/2099/3 "2021-10-17T05:04:32Z")

</div>

Thank you for your answer, @fortran4r.

> Could you elaborate on the limitations of Geany as a Fortran editor/IDE?

The biggest issue I have with Geany at the moment is the lack of a hover/mini-documentation when using subroutines, functions, etc. With VS Code and Code::Blocks, I’m able to see the types of all variables declared, I have access to this mini-documentation ([example](https://stackoverflow.com/questions/47455756/how-to-trigger-documentation-popup-in-vscode)) and other quality of life features I enjoy due to how much I’ve used VS Code with Python. I know that Geany can be very useful with all of its plugins, but it won’t solve my problem at the moment.

I appreciate the suggestion nonetheless. If possible, could you tell me how you use Geany? Your plugins, your config. options, and the like? I’d enjoy to give it another chance as well. I must’ve been using it wrong.

---

<div class="post-metadata">

**Author:** ![fortran4r](https://avatars.discourse-cdn.com/v4/letter/f/9de0a6/32.png) [@fortran4r](https://fortran-lang.discourse.group/u/fortran4r)\
**Post date:** [October 17, 2021, 5:09am UTC](https://fortran-lang.discourse.group/t/code-blocks-fortran-theme-issue/2099/4 "2021-10-17T05:09:04Z")

</div>

I basically use Geany as an editor instead of an IDE. No special settings or plugins are used. If hover/mini-documentation is your concern, then you should consider VSCode.

---

<div class="post-metadata">

**Author:** ![art-rasa](https://avatars.discourse-cdn.com/v4/letter/a/90ced4/32.png) [@art-rasa](https://fortran-lang.discourse.group/u/art-rasa)\
**Post date:** [October 17, 2021, 8:43am UTC](https://fortran-lang.discourse.group/t/code-blocks-fortran-theme-issue/2099/5 "2021-10-17T08:43:03Z")

</div>

I use Geany myself for Fortran coding, it’s fast, lightweight and it has all the features I need as a novice programmer. I especially like how it doesn’t automatically check and highlight any syntax errors, etc. _while_ I am typing. More “professional” IDEs (at least Qt Creator) tend to do this. I find that feature very distracting.

---

<div class="post-metadata">

**Author:** ![nbehrnd](https://avatars.discourse-cdn.com/v4/letter/n/e0b2c6/32.png) [@nbehrnd](https://fortran-lang.discourse.group/u/nbehrnd)\
**Post date:** [October 17, 2021, 11:38am UTC](https://fortran-lang.discourse.group/t/code-blocks-fortran-theme-issue/2099/6 "2021-10-17T11:38:04Z")

</div>

> [@Uendo](#):
>
> I’d like to give Emacs a try as well

There are _at least_ two approaches to follow this idea with multiple supporting Emacs modules.

- You may write code in one buffer, and subsequent transition into the other one (`C-x o`) as demonstrated in many of the examples e.g., by Cyprien Rusu’s Fortran video tutorials (example 4:30 mm:ss [tuto 2](https://www.youtube.com/watch?v=GSJL6E1A6gM)) for compilation and execution

- You may opt for Emacs [org mode](https://orgmode.org/) (a modern installation of Emacs already includes this as a major mode by default) to write/compile/execute your Fortran code in an `.org` file.

For illustration of option 2, I add file `example.org` as a MWE file below:

```org
#+OPTIONS: toc:nil # disable a table of content if exported to .html

* This is a chapter

  Text may be normal, /italic/, *bold*, _underlined_, or =monospace font=.

  The following defines a simple Fortran program. Current Emacs orgmode eases
  the input of such a block about /source code/ by input =C+c C+ s=.

  With =fortran=, the syntax highlighting is enabled. For the code's eventual
  execution, it is exported into file =hello.f90=, in orgmode's parlance
  "tangled", which will reside in the same folder as the current .org mode.

  #+begin_src fortran :tangle hello.f90
    program EvenNumbers
    implicit none
    
    integer :: i
    
    do i = 1, 5
       if (mod(i, 2) == 0) then
           print *, i, " is an even number"
       else
           print *, i, " is an odd number"
       end if
    end do
    
    end program EvenNumbers
  #+end_src

  The following block calls the compiler with bash. Move the cursor to the
  block, and execute the command by =C+c C+c=.
  #+begin_src sh
    gfortran hello.f90 -o check -Wall -Wpedantic
  #+end_src

  #+RESULTS:

  The executable is used (again =C+c C+c=), the additional parameter in the
  header instructs the format shall be like the one obtained on the CLI:
  #+begin_src sh :results output
    ./check
  #+end_src

  #+RESULTS:
  : 1 is an odd number
  : 2 is an even number
  : 3 is an odd number
  : 4 is an even number
  : 5 is an odd number

```

(Apparently, discourse does not yet recognize the org format.)

I like that this approach provides syntax highlighting, and increases the indentation for the next line once the condition is defined. It is possible to tangle multiple separate blocks eventually into one source code file in common; this allows to keep some annotations (like commenting lecture notes) with cross references and personal comments separate from the `.f90` source code eventually shared. Or you opt for the export of this plain ASCII file from Emacs in as `.tex` (and if you have `pdflatex`, into `.pdf`), `.odt`, or `.html` , e.g., by `C-c C-e h o`.

Let’s assume I replace `else` by `else if` in the Fortran block and tangle this again. The second block (about the compilation) is going to report the anticipated warnings in a buffer opened automatically as soon as I call `C-c C-c`:

 ![error](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/1X/72e3ab4238ae036fdc70e34e8316602c2210a3c5.png)

John Kitchin (CMU) is one of the proponents of this approach of reproducible research and demonstrates some benefits in his brief video [here](https://www.youtube.com/watch?v=fgizHHd7nOo) (at 11:00 mm:ss onward for basics, at 14:09 mm:ss a specific example for Fortran).

---

<div class="post-metadata">

**Author:** ![Uendo](https://avatars.discourse-cdn.com/v4/letter/u/ed655f/32.png) [@Uendo](https://fortran-lang.discourse.group/u/Uendo)\
**Post date:** [October 17, 2021, 4:12pm UTC](https://fortran-lang.discourse.group/t/code-blocks-fortran-theme-issue/2099/7 "2021-10-17T16:12:39Z")

</div>

Thank you all for your answers. I’m going to switch to VS Code and later on I’ll try @nbehrnd’s suggestion.
